Is there an API to get if all selectable rows are selected? #4801
Unanswered
danteissaias
asked this question in
Q&A
Replies: 1 comment 4 replies
-
Is this what you're looking for? const selectableRows = table
.getRowModel()
.flatRows.filter((row) => row.getCanSelect());
const { flatRows } = table.getSelectedRowModel();
const getIsChecked = () => {
if(table.getIsAllRowsSelected())
return true
}
if(table.getIsSomeRowsSelected()) {
return "indeterminate"
}
return false
}
return (
<Checkbox
checked={getIsChecked()}
onCheckedChange={() => table.toggleAllRowsSelected()}
/>
); |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I enable selection conditionally for certain rows. I want to know if all selectable rows are selected. This is my workaround, is there a way to do with with TanStack Table's API?
Beta Was this translation helpful? Give feedback.
All reactions