Adding multiple elements, such as an array for an existing Kendo UI data source

I have been working on this for several hours and cannot find a way to make it work correctly. I am looking for a suitable way to add the contents of an array to an existing Kendo UI DataSource. Basically, I have 4 SharePoint lists, and I get data using DataJS from each list. Then I want to display the elements in the Kendo GridView, but I do not want to add elements using the for statement and the add() method. I tried to use the add() method in the array directly, but all this does is add the array as the object itself to the DataSource and, of course, this is not the intended behavior. I also tried using dataSource.data.concat() but got an error:

Object does not support property or method 'concat'

+4
source share
2 answers

Suppose you have new data in an array named newData . You can use:

 var newData = [ { ... }, { ... }, { ... } ]; $.merge(newData, datasource._pristine); datasource.data(newData); 
+11
source

The above solution did not work for me. The following method suggested by the Telerik administrator:

 var vm = kendo.observable({ data: new kendo.data.ObservableArray([]) }); vm.data.push.apply(vm.data, [ 1, 2, 3]); 

Thus, one render for related widgets is obtained. Found here: http://www.telerik.com/forums/passing-array-to-observablearray-push

+1
source

All Articles