Css 是否可以删除';选中标记';在不可选择的行上

Css 是否可以删除';选中标记';在不可选择的行上,css,angularjs,angular-ui-grid,Css,Angularjs,Angular Ui Grid,我们使用的是ui grid v3.1.1,并且有一个特定的用例,其中网格需要有某些行可选择,而其他行不可选择,这取决于行中特定单元格的代码。我们已经将网格的html实现为: <div id="gridSummary" ui-grid="gridOptions" class="grid-summary" ui-grid-auto-resize ui-grid-selection ui-grid-tree-view ui-grid-pinning> <div cla

我们使用的是ui grid v3.1.1,并且有一个特定的用例,其中网格需要有某些行可选择,而其他行不可选择,这取决于行中特定单元格的代码。我们已经将网格的html实现为:

<div id="gridSummary" ui-grid="gridOptions" class="grid-summary" ui-grid-auto-resize ui-grid-selection ui-grid-tree-view ui-grid-pinning>
        <div class="grid-empty" ng-show="!gridOptions.data.length">No Corresponding Data Found</div>
</div>

没有找到相应的数据
我们一直在试验isRowSelectable gridOption,它可以实现我们想要的功能,除了一个问题:我们不希望禁用的复选标记图标出现在不可选择的行上。当行不可选择时,是否有办法使复选标记隐藏/折叠


谢谢

您可以通过更改不可选择行的
行标题图标
来实现这一点

您可以覆盖选择行标题按钮的模板,并添加自定义css。在控制器中插入
templateCache
,然后像这样覆盖模板

$templateCache.put('ui-grid/selectionRowHeaderButtons',
    "<div class=\"ui-grid-selection-row-header-buttons\" ng-class=\"{'ui-grid-row-selected': row.isSelected , 'ui-grid-icon-cancel':!grid.appScope.isSelectable(row.entity), 'ui-grid-icon-ok':grid.appScope.isSelectable(row.entity)}\" ng-click=\"selectButtonClick(row, $event)\">&nbsp;</div>"
  );
$templateCache.put('ui-grid/selectionRowHeaderButtons',
" "
);
模板将使用控制器范围中的方法来确定行是否可选择

我觉得这很有用。

$templateCache.put('ui-grid/selectionRowHeaderButtons',
" "
);

漂亮。非常感谢。他很有魅力。
  $templateCache.put('ui-grid/selectionRowHeaderButtons',
    "<div ng-class=\"{'ui-grid-selection-row-header-buttons': grid.appScope.isSelectable(row), 'ui-grid-icon-ok' : grid.appScope.isSelectable(row), 'ui-grid-row-selected': row.isSelected}\" ng-click=\"selectButtonClick(row, $event)\">&nbsp;</div>"
  );