TanStackT
TanStackโ€ข3y ago
verbal-lime

Best way to reset rowSelection on data change

๐Ÿ‘‹๐Ÿฝ Hey,
I wonder what is the best way to reset the selected rows when the data changes (server side-sorting, or server-side pagination). Initially the rowSelection should not be reset!

Is this the way to go?
  useEffect(() => {
    table.resetRowSelection(); // does not work, cause also the initial rowSelection is reset
  }, [data]);

or should I use the onStateChange-event? If yes, how?
An answer from someone who knows better (maybe @KevinVandy ๐Ÿ˜Š ) would be appreciated.

Many thanks
Was this page helpful?