I've been working on this for a few hours and cannot manage to find a way to get it to work properly. I'm looking for the proper way to add the contents of an array to an existing Kendo UI DataSource. Basically I have 4 SharePoint lists and I am fetching data using DataJS from each list. I want to then display the items in a Kendo GridView but I don't want to add the items using a for
statement and the add()
method. I have tried using the add()
method on the array directly but all this does is add the array as an object itself to the DataSource and, of course, that is not the intended behavior. I also attempted using dataSource.data.concat()
but received the error:
Object doesn't support property or method 'concat'
Lets say that you have the new data in an array called newData
. You can use:
var newData = [
{ ... },
{ ... },
{ ... }
];
$.merge(newData, datasource._pristine);
datasource.data(newData);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With