Binding/Syncing Variable with Local Data

2 posts, 0 answers
  1. Lawrence
    Lawrence avatar
    7 posts
    Member since:
    Jun 2015

    Posted 14 Mar 2016 Link to this post

    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.

  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2895 posts

    Posted 16 Mar 2016 Link to this post

    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!
     
Back to Top