admin管理员组文章数量:1242805
Is it possible to "disable" or lock the selection of a ng-grid using the inbuilt functionality? I want the user to be able to select a row, click a button and then the grid will stay locked until the user presses another button.
Is it possible to "disable" or lock the selection of a ng-grid using the inbuilt functionality? I want the user to be able to select a row, click a button and then the grid will stay locked until the user presses another button.
Share Improve this question edited Mar 21, 2016 at 8:52 Tim asked Oct 30, 2013 at 16:24 TimTim 7,43113 gold badges63 silver badges103 bronze badges3 Answers
Reset to default 11Yes, you can return false
from beforeSelectionChange
to disable changing the selected rows on the grid.
$scope.option = {
enableRowSelection: true,
};
$scope.gridOptions = {
data: 'myData',
beforeSelectionChange: function() {
return $scope.option.enableRowSelection;
}
//, ...
};
HTML:
<button ng-click="option.enableRowSelection=false">Freeze Selection</button> <button ng-click="option.enableRowSelection=true">Unfreeze Selection</button> <div class="gridStyle" ng-grid="gridOptions"></div>
Example Code: http://plnkr.co/edit/PbhPzv?p=preview
See also: https://github./angular-ui/ng-grid/wiki/Configuration-Options
This works in Angular 2.3:
constructor() {
this.gridOptions = <GridOptions>{};
this.gridOptions.suppressCellSelection = true;
}
add below code to gridoption
enableRowHeaderSelection: false
本文标签: javascripthowto disable selection in nggridStack Overflow
版权声明:本文标题:javascript - howto disable selection in ng-grid - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740116632a2227208.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论