Controlled checkbox selection #776
SourceCipher
started this conversation in
General
Replies: 1 comment
-
This is an old thread, but other people might search for this, so here's an answer. Use const [gridSelection, setGridSelection] = useState<GridSelection>({
columns: CompactSelection.empty(),
rows: CompactSelection.empty()
})
// ...
<DataGrid
gridSelection={gridSelection}
onGridSelectionChange={(sel) => {
if (sel.rows.length === 0 && sel.current?.cell !== undefined) {
const [, row] = sel.current.cell
setGridSelection({
...gridSelection,
columns: CompactSelection.empty(),
rows: CompactSelection.empty().add(row)
})
} else {
setGridSelection(sel)
}
}}
... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can we select the checkbox just by clicking on any cell?
We basically have a functionality which is row highlighting on click of any cell, but I cant find a way to do this with this table. I see the option to highlight the cells but thats not what we need. We need to be able to basically select the row like this on any cell selection:
Beta Was this translation helpful? Give feedback.
All reactions