0

In my Angular apps I am using UI Grid (http://ui-grid.info/docs/#/tutorial)

How do I get the data of the selected row ?

Plunker : http://plnkr.co/edit/GpsfCHewYjhiPcwAQheA?p=preview

HTML:

<div ui-grid="gridOptions" ui-grid-selection class="grid"></div>

1 Answer 1

2

The grid selection module has a method to get the selected rows: getSelectedRows().

You can access this method through the gridApi if you define your options like so:

$scope.gridOptions = {
  columnDefs: $scope.columns,
  onRegisterApi: function(gridApi) {
    $scope.gridApi = gridApi;
  }
};
Sign up to request clarification or add additional context in comments.

2 Comments

Very helpful. Are there any events triggered on selecting a checkbox? I want to get the primary key of the selected row.
There is a rowSelectionChanged event which should suit your requirement. (ui-grid.info/docs/#/api/ui.grid.selection.api:PublicApi)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.