AngularJS/ng-grid - Updating array with splice doesn't updates UI

后端 未结 3 1333
独厮守ぢ
独厮守ぢ 2020-12-18 05:37

I am trying to update ng-grid with array splice. I have a plunk here.

Add button adds new row. Update button updates

3条回答
  •  攒了一身酷
    2020-12-18 06:14

    That's because data $watcher in ng-grid (incorrectly) compares the data object for reference, instead on object equality. You might remedy this by setting the third parameter to true in data $watch function (line 3128):

    $scope.$parent.$watch(options.data, dataWatcher, true);
    

    Plunker

提交回复
热议问题