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

Data Source cloning

1 Answer 1210 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Nilesh
Top achievements
Rank 1
Nilesh asked on 05 Aug 2015, 05:50 PM
Hello,

We are using the single local DataSource at many places so we want to clone the DataSource. Please suggest the best way to clone 
the dataSource.

Best Regards,
Nilesh Padbidri

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 07 Aug 2015, 09:09 AM
Hello Nilesh,

The dataSource does not have a clone method. Instead you may store the dataSource configuration in an object and use it every time when you want to build new instance.

var dataSourceConfig = {
  data: [{foo: "bar"}],
  pageSize: 3,
  /* etc... */
};
 
var ds1 = new kendo.data.DataSource(dataSourceConfig);
var ds2 = new kendo.data.DataSource(dataSourceConfig);


I hope this approach will fit in your scenario.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Data Source
Asked by
Nilesh
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or