Data Source cloning

2 posts, 0 answers
  1. Nilesh
    Nilesh avatar
    9 posts
    Member since:
    Jan 2013

    Posted 05 Aug 2015 Link to this post

    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
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 07 Aug 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top