【发布时间】:2016-07-04 01:31:58
【问题描述】:
我正在尝试在基于 Angular 1.5 的项目中使用 ag-grid 自定义数据表。自定义是允许用户选择表中的最大行数,例如最大为2。
I have the following code by using node.setSelected(false) that I found in the documentation page here, but I got the error: node.setSelected is not a function when the selection exceeds the maximum of 2.
var gridOptions = {
columnDefs: columnDefs,
rowSelection: 'multiple',
onRowSelected: onRowSelected
};
function onRowSelected(event) {
var curSelectedNode = event.node;
var selectionCounts = vm.gridOptions.api.getSelectedNodes().length;
if (selectionCounts > 2) {
var oldestNode = vm.gridOptions.api.getSelectedNodes()[0]; // get the first node, to be popped out
oldestNode.setSelected(false); // causes the above 'not a function' error
}
}
有谁知道 ag-grid 的setSelected() API 可能有什么问题?或者有什么更好的方法来进行这种定制?
【问题讨论】:
标签: angularjs datatable row selection ag-grid