Search code examples
angularjsng-grid

ngGrid - remove row


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? Here is the plunker example.

The function I implement acts weird, as it removes other rows.

Thank you.


Solution

  • That is not a proper way to delete any row

    Try like this:

    $scope.removeRow = function() {
       var index = this.row.rowIndex;
       $scope.gridOptions.selectItem(index, false);
       $scope.myData.splice(index, 1);
    };
    

    PLUNKER --> Its working and tested