I'm using ui-grid. But I cannot get the $scope.gridApi from download function. And get the error: Cannot read property 'selection' of undefined. Somebody can tell me the reason? thanks.
$scope.gridOptions.onRegisterApi = function (gridApi) {
$log.info('gridApi...');
$scope.gridApi = gridApi;
$log.info($scope.gridApi);
};
$scope.download = function ($event) {
$event.stopPropagation();
var selectedRows = $scope.gridApi.selection.getSelectedRows();
$log.log('selectedRows....');
$log.log(selectedRows);
};
ui-grid-selection
to add to your div<div ui-grid="gridOptions" class="grid" style="height: 100% !important" ui-grid-edit ui-grid-pagination ui-grid-selection></div>
– Aulea