React Table - useRowSelect change select all default behavior

Viewed 1055

I am using the selection hook in my react table and I can't find a way to override the select all checkbox behavior. When the select all checkbox is checked if you uncheck a specific row in the table it turns the isAllRowsSelected to false.

I want it to change only if the header checkbox is clicked, because I want to be able to have a state that says "all results, except the unmarked ones".

I am using server side pagination so I can't rely only on the selectedRowIds array. This is the implementation of useRowSelect I used : here

1 Answers

You can add this line, it trigers on component mount.

React.useEffect(()=> {toggleAllRowsSelected()},[])

All code like this: codesandbox

Related