AngularJS - UIGrid - 如何读取选定行的数据?

AngularJS - UIGrid - How to read data for a selected row?

在我的 Angular 应用程序中,我正在使用 UI 网格 (http://ui-grid.info/docs/#/tutorial)

如何获取所选行的数据?

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

HTML:

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

grid selection module 有一个获取选中行的方法:getSelectedRows().

如果您像这样定义选项,则可以通过 gridApi 访问此方法:

$scope.gridOptions = {
  columnDefs: $scope.columns,
  onRegisterApi: function(gridApi) {
    $scope.gridApi = gridApi;
  }
};