ngGrid - remove row

oblivion19 picture oblivion19 · Jun 28, 2013 · Viewed 19.2k times · Source

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.

Answer

Dhaval Marthak picture Dhaval Marthak · Jun 28, 2013

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