ngGrid - remove row

前端 未结 6 705
猫巷女王i
猫巷女王i 2021-02-04 15:34

I have been looking for an example on how to implement a button to remove a selected row, but I couldn\'t find anything useful so far.

Can anyone please give me a hint?

6条回答
  •  说谎
    说谎 (楼主)
    2021-02-04 16:23

    This might help you, and also this is for deleting multiple rows in the grid.

    $scope.mySelections = [];
    
    $scope.gridOptions = {
        data :'gridData',
        selectedItems : $scope.mySelections,
        showSelectionCheckbox : true
    }
    
    $scope.deleteSelected = function() {
        angular.forEach($scope.mySelections, function(rowItem) { 
        $scope.gridData.splice($scope.gridData.indexOf(rowItem),1);
    });
    }
    

    mySelections is the array which has selected rows

提交回复
热议问题