Hi Guys,
I am trying to set a datasource for an ag-grid but for a strange reason I am getting an error:
platform-browser.umd.js:2306 STACKTRACE:BrowserDomAdapter.logError @ platform-browser.umd.js:2306
platform-browser.umd.js:2306 TypeError: rowData.forEach is not a function
at recursiveFunction (inMemoryRowModel.js:355)
at InMemoryRowModel.createRowNodesFromData (inMemoryRowModel.js:330)
at InMemoryRowModel.setRowData (inMemoryRowModel.js:296)
at PaginationController.pageLoaded (paginationController.js:138)
at Object.successCallback (paginationController.js:210)
at SafeSubscriber.eval [as _next] (clients.component.ts:58)
at SafeSubscriber.__tryOrUnsub (Rx.js?1467025050775:10855)
at SafeSubscriber.next (Rx.js?1467025050775:10810)
at Subscriber._next (Rx.js?1467025050775:10766)
at Subscriber.next (Rx.js?1467025050775:10743)BrowserDomAdapter.logError @ platform-browser.umd.js:2306
Rx.js?1467025050775:10858 Uncaught TypeError: rowData.forEach is not a function
This is my code:
dataSource = {
pageSize: 10,
overflowSize: 100,
getRows: (params: any) => {
this.returnRows().subscribe(data => {
var test =
[{"ClientName":"Ronald Bowman","Country":"China","CreatedOn":"Lutou","email":"rbow...@spotify.com"},
{"ClientName":"Pamela Hill","Country":"Russia","CreatedOn":"Krylovskaya","email":"phi...@symantec.com"},
{"ClientName":"Robin Andrews","Country":"Ukraine","CreatedOn":"Korop","email":"rand...@photobucket.com"},
{"ClientName":"Peter Kim","Country":"Mexico","CreatedOn":"San Jose","email":"pk...@theatlantic.com"},
{"ClientName":"Carol Foster","Country":"Mexico","CreatedOn":"El Aguacate","email":"cfos...@intel.com"},
];
var rowsThisPage = data.slice(params.startRow, params.endRow);
var lastRow = -1;
params.successCallback(rowsThisPage, lastRow);
});
}
}
As it, data.slice(params.startRow, params.endRow); it is giving me the error and the ag-grid remains empty. As soon as I replace data with test variable it works.
the data object has JSON data as well since I test out even through console.log but some reason it is not working. I tested also that it is a valid json.
Anybody can help me pleasE?
Kind Regards