2014-02-06 29 views

回答

0

得到这个一个固定用以下解决方案,请让我知道如果你有一个更好的解决办法,或者你看到任何问题与此有关。

$scope.myGridOptions = { 
    data: 'gridData', 
    enableSorting: false, 
    showSelectionCheckbox: true, 
    selectedItems: $scope.selectedData, 
    selectWithCheckboxOnly: true, 
    afterSelectionChange: function (rowItem) { return $scope.updateRowSelection(rowItem); }}; 


$scope.updateRowSelection = function (rowItem) { 
    if (rowItem.length) { 
     for(var i = 0 ; i < rowItem.length ; i ++) { //Foreach can be used 
      if (!$scope.isMySelectionAllowed(rowItem[i].entity)){ 
       if (rowItem[i].selected) { 
        $scope.myGridOptions.selectRow(rowItem[i].rowIndex, false); 
       } 
      } 
     } 
    } 
}; 
相关问题