deselect all rows in ng grid

rajmohan picture rajmohan · Jan 8, 2014 · Viewed 8.4k times · Source

Please find the ng grid example in plunker

http://plnkr.co/edit/CncDWCktXTuBQdDVfuVv?p=preview

It will allow user to select only one row but there will be one selected row at all time. I want to deselect all rows.

Answer

KrishnaDhungana picture KrishnaDhungana · Jan 8, 2014

ng-grid has keepLastSelected option.

Try:

keepLastSelected: false in gridOptions. This will toggle selection.

Example

$scope.gridOptions = { 
      data: 'myData',
      selectedItems: $scope.mySelections,
      multiSelect: false,
      keepLastSelected: false
    };