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":"[email protected]"},
                    {"ClientName":"Pamela Hill","Country":"Russia",
"CreatedOn":"Krylovskaya","email":"[email protected]"},
                    {"ClientName":"Robin Andrews","Country":"Ukraine",
"CreatedOn":"Korop","email":"[email protected]"},
                    {"ClientName":"Peter Kim","Country":"Mexico","CreatedOn"
:"San Jose","email":"[email protected]"},
                    {"ClientName":"Carol Foster","Country":"Mexico",
"CreatedOn":"El Aguacate","email":"[email protected]"},
                 ];


                 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

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to