如何禁止根据 Angular UI 网格中的列值选择某些记录?

How to disable selection of some records based on a column value in Angular UI Grid?

我正在使用 Angular UI 网格,enableRowHeaderSelection 值为 true。这允许用户通过单击复选框来 select 行。

有没有办法根据列值禁用某些行的 selection 行?

这就是您要查找的内容:http://ui-grid.info/docs/#/tutorial/210_selection

工作的 Plunker:http://plnkr.co/edit/vJbvJhgyKbYomW4VIsKs?p=preview

You can use an isRowSelectable function to determine which rows are selectable. If you set this function in the options after grid initialisation you need to call gridApi.core.notifyDataChange(uiGridConstants.dataChange.OPTIONS) to enable the option.

$scope.gridOptions.isRowSelectable = function(row) {
    if(row.entity.name === "Jack") return false;
    else return true;
}
$scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.OPTIONS);