angular ui-grid event: row selected

前端 未结 3 1515
我在风中等你
我在风中等你 2021-02-19 02:14

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

3条回答
  •  别跟我提以往
    2021-02-19 02:56

       $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

        
    

提交回复
热议问题