Angular JS UI-Grid Delete Row

后端 未结 5 505
野趣味
野趣味 2021-02-05 16:47

I\'m new to ui-grid and I\'m trying to implement a table in AngularJS as shown in the picture below. I\'m trying to select a row and delete it using a delete button

5条回答
  •  太阳男子
    2021-02-05 17:26

    The other solutions provided here didn't worked for me(May be because of my latest different version of ui-grid). So removing element from the scope array worked for me. This should even work with other versions of ui-grid because grid must be updated when the data changes. (Thanks to Angular!!!)

    I am using lodash to remove element from array and here is sample code:

    $scope.deleteRow = function(row){
        _.remove($scope.gridData, {
            id: row.id
        });
    };
    

提交回复
热议问题