TanStackT
TanStack3y ago
1 reply
wet-aqua

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]);


I am not able to maintain the deselected row.

I am using v8 React Table
Was this page helpful?