T
TanStack3y ago
unwilling-turquoise

Select row if it is enabled for selection

Can someone help how should I select the row if my enableRowSelection criteria is fulfilled and vice versa and also the user can deselect the selected row. I tried this
useEffect(() => {
table.getRowModel().rows.forEach((item, idx) => {
if (item.getCanSelect()) {
table.setRowSelection((prev) => ({ ...prev, [idx]: true }))
}
});
}, [data, table]);
useEffect(() => {
table.getRowModel().rows.forEach((item, idx) => {
if (item.getCanSelect()) {
table.setRowSelection((prev) => ({ ...prev, [idx]: true }))
}
});
}, [data, table]);
I am not able to maintain the deselected row. I am using v8 React Table
1 Reply
sunny-green
sunny-green3y ago
Yeah I'm having similar problems. Cant find anything in the docs either

Did you find this page helpful?