Where can I get Angular ui-grid selected items Where can I get Angular ui-grid selected items angularjs angularjs

Where can I get Angular ui-grid selected items


Is this what your are looking for ? http://ui-grid.info/docs/#/tutorial/210_selection

  1. Activate grid selection capabilities with the ui-grid-selection tag (and ui.grid.selection module registration in your app
  2. register gridApi and use gridApi.selection to access getSelectedRows()


In addition to the steps above https://stackoverflow.com/a/26188783/2658127, you might have to invoke it through a ng-click event to get the actual value/object. At least that's how I had it working.

Eg:$scope.selectRow = function(){    $scope.gridApi.selection.getSelectedRows();};

And call selectRow() from the template.

This is for anybody who have been confused like I did, considering the fact that ui-grid does not have the best documentation (specially for this select portion).


The easiest approach is:

  1. Register the gridApi by adding this your controller:

    $scope.gridOptions.onRegisterApi = function(gridApi) { $scope.myGridApi = gridApi; };

  2. Access the array of selected items:

    $scope.myGridApi.selection.getSelectedRows();