我正在尝试ag-grid
在基于 Angular 1.5 的项目中使用自定义数据表。自定义是允许用户选择表格中的最大行数,例如最大为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 可能有什么问题?或者有什么更好的方法来做这个定制?