kitensei kitensei - 2 years ago 1264
AngularJS Question

angular ui-grid 3.0 get selected rows

This answer states that this code:

$scope.gridOptions.onRegisterApi = function(gridApi){

$scope.gridApi = gridApi;

Should work in order to get the selected rows, but to me it returns always [], to get track of selected rows I have to call
each time a selection event is triggered, is this correct ?

What I want to achieve is to do my own footer that tracks the number of selected rows of the grid, is this the correct way of achieving this ?

Answer Source

There is already an example of showing the number of selected elements in the footer.

This plnkr shows the selected items footer.

If you want to do further analysis on the selected row you can register a listener for the row selection and act on that.

 $scope.gridOptions.onRegisterApi = function(gridApi){
      //set gridApi on scope
      $scope.gridApi = gridApi;
        var msg = 'row selected ' + row.isSelected;

        var msg = 'rows changed ' + rows.length;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download