This is a migrated thread and some comments may be shown as answers.

Clone datasource between datagrids

1 Answer 415 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
Irene asked on 14 Sep 2015, 09:55 AM


We have a window with 2 datagrids that allow select data from one grid to another. We have the four tipical options (add one, remove one, add all, remove all), our problem is in the "add all" option.

 We need to clone the datasource from one grid to another and this is our try:


var gridAllData = $("gridAll").data("kendoGrid");
var gridSelectedData = $("gridSel").data("kendoGrid");
var ds = new;
var allData =;
var filters = gridAllData.dataSource.filter();
var query = new;
var dataFilter = query.filter(filters).data;
for (var i=0; i < dataFilter.length; i++){


The problem is that it's very slow when there are many records. What is the best method to clone the datasource?

1 Answer, 1 is accepted

Sort by
Alexander Valchev
Telerik team
answered on 16 Sep 2015, 07:25 AM
Hello Irene,

The slowest operation should be the for loop where add method is called.
Please try to replace the whole data at once through the data method of the dataSource instead of calling add multiple times.

Also it will help if you set the dataSource to the Grid after the dataSource is populated.

Alexander Valchev
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Asked by
Top achievements
Rank 2
Answers by
Alexander Valchev
Telerik team
Share this question