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

Binding/Syncing Variable with Local Data

1 Answer 688 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lawrence
Top achievements
Rank 1
Lawrence asked on 14 Mar 2016, 09:05 PM

I have a local variable ($scope.objects) that contains an array of objects.

I have a kendoGrid that has a dataSource that uses the $scope.objects as its data. This grid has the "destroy" command; when I click the "destroy" button, it removes the item from the grid, but not from $scope.objects. Is there any way to bind/sync these two (dataItems in grid and $scope.objects) together?

I found a few ways to handle this, but it all required me to manually change $scope.objects. 

 

01.$scope.objects = [{...}, {...}, {...}];
02.$scope.dataSource = new kendo.data.DataSource({
03.    data: $scope.objects,
04.    //...
05.});
06.$scope.grid = $("grid").kendoGrid({
07.    dataSource: $scope.dataSource,
08.    //...
09.});

 

I am also looking for something similar for create and update.

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 16 Mar 2016, 02:26 PM
Hello Lawrence,

Check this help article as it demonstrates how to configure CRUD operations with local data:

The same approach should be used in Angular JS application.

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
Grid
Asked by
Lawrence
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or