I am trying to enable/disable a button based on the selection of a row on a ui-grid. If there are no rows selected, the button is disabled.
I found this plunkr with the
$scope.countRows=0;
$scope.gridOptions.onRegisterApi = function(gridApi){
$scope.gridApi = gridApi;
gridApi.selection.on.rowSelectionChanged($scope, function(row){
$scope.countRows = $scope.gridApi.selection.getSelectedRows().length;
});
gridApi.selection.on.rowSelectionChangedBatch($scope, function(row){
$scope.countRows = $scope.gridApi.selection.getSelectedRows().length;
});
};
In the HTML side you can use some thing like this