[英]How do i get a handle of the “Select All” checkbox in react-data-grid
[英]How to disable checkbox for a row in rowselection in react-data-grid
<ReactDataGrid
columns={[
{ key: 'time', name: 'time', width: 140, formatter: (props) => (<span>{props.value}</span>), sortable: true },
{ key: 'Size', name: 'Size', width: 80, formatter: (props) => (<span>{props.value}</span>) },
{ key: 'qaw', name: 'dash Value', width: 350 },
]}
rowGetter={this.rowGetter}
rowsCount={list.length}
emptyRowsView={() => (<div />)}
rowSelection={{
showCheckbox: true,
onRowsSelected: this.onVersionRowsSelect,
onRowsDeselected: this.onVersionRowsDeselect,
selectBy: {
indexes: this.state.selectedIndexes
}
}}
/>
以上是我的 react-data-grid 代碼。 我想在某些條件下禁用特定行的行選擇,或者想禁用該特定行的復選框。
請讓我知道如何實現。 謝謝
您可以通過執行以下操作來禁用該行的選擇:-
onVersionRowsSelect(rows) {
rows = rows.filter(item => !item.row.isSnapshotQuarantined)
this.setState({
selectedIndexes: this.state.selectedIndexes.concat(rows.map(r => r.rowIdx))
});
}
我不確定您是否可以更改禁用復選框的視覺效果,因為react-data-grid
未公開復選框 html 的控件(據我所知)。
希望這可以幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.