设置selectable: row
。网格允许您选择每个页面中的项目。我只想在网格中只选择一行并将所选行限制为1.
<Grid
{...{
dataSource: dataSource,
sortable: sortable,
selectable: selectable,
scrollable: false,
navigatable: true,
filterable: filterable,
allowCopy: allowCopy,
pageable: pageable,
perPage: perPage,
editable: editable,
change: e => e.sender.selectedKeyNames()),
persistSelection: true,
columns: [
{
template: "<span class='sl-select-check'></span>",
attributes: { class: 'sl-select-check-td' }
},
...columns
]
}}
/>
答案 0 :(得分:1)
在React中实现的新版Kendo Grid会更容易: https://www.telerik.com/kendo-react-ui/components/grid/selection/ 在此演示中,选择代码是完全可自定义的,如果选择了项目的状态,或者项目本身没有。
if (!event.nativeEvent.ctrlKey) {
this.state.data.forEach(item => item.selected = false);
}
//this works across pages.