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

Merge two kendo.data.ObservableArray objects

1 Answer 209 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Yatish
Top achievements
Rank 1
Yatish asked on 27 Sep 2016, 06:27 PM

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

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 28 Sep 2016, 10:37 AM
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.
 
Tags
Data Source
Asked by
Yatish
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or