Merge two kendo.data.ObservableArray objects

2 posts, 0 answers
  1. Yatish
    Yatish avatar
    5 posts
    Member since:
    Apr 2016

    Posted 27 Sep Link to this post

    Hi,

    I am have two grid and need to merge the data from the two grids. I get the datasource for each of the grid, but I am not sure how to merge the data. (I have tried push method on the observablearray but failed to merge the objects).

                var items1= $scope.items1Grid.dataSource.data();
                var items2= $scope.items2Grid.dataSource.data();
                var mergedItems= items1.push(items2);

     

    Anyway to accomplish this?

    Thank you

    YK

  2. Stefan
    Admin
    Stefan avatar
    264 posts

    Posted 28 Sep Link to this post

    Hello Yatish,

    I can assume the desired result is one of the following two:

    1) To merge the two arrays into one array. If this is the desired result, I can suggest using the merge method to merge the arrays into one.

    https://api.jquery.com/jquery.merge/

    2) To merge the first object from array one with the first object from array two. If this is the requirement, I can suggest the extend method:

    https://api.jquery.com/jquery.extend/

    Also, I made a Dojo example demonstrating both implementations:

    http://dojo.telerik.com/osIyE

    I hope this will help you to achieve the desired result.

    Regards,
    Stefan
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  3. Kendo UI is VS 2017 Ready
Back to Top