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

后端 未结 3 1335
独厮守ぢ
独厮守ぢ 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条回答
  •  Happy的楠姐
    2020-12-18 06:11

    I am using ui-grid v3.0.0 (from an April 2015 unstable build). I found this post and wanted to show others how I refreshed my grid after I removed a row from the grid data object using splice:

    // Remove the row and refresh the grid.
    $scope.myData.splice(rowIndex, 1);
    $scope.gridApi.grid.refresh(true);
    

    where my gridApi scope variable was set with this function:

    $scope.gridOptions.onRegisterApi = function(gridApi){
        $scope.gridApi = gridApi;
    }
    

提交回复
热议问题