Angular JS UI-Grid Delete Row

后端 未结 5 504
野趣味
野趣味 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:37

    You can use @Blousie solution as far as you adapt it to the newer API: https://github.com/angular-ui/ng-grid/blob/master/3.0_UPGRADE.md

    Now "grid.appScope.edit(row.entity)" gives you access to your scope's "edit" function.

    Something like this:

    var removeTemplate = '';
    
    $scope.removeRow = function(row) {
        var index = $scope..indexOf(row.entity);
        if (index !== -1) {
            $scope..splice(index, 1);
        }
    };
    

提交回复
热议问题