delete rows outside the react-table component #4765
Unanswered
Supermann89
asked this question in
Q&A
Replies: 0 comments
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.
-
Hi, i use @tanstack/react-table lib.
How can i delete rows outside the AppTable component?
So, i create demo project, where there are one button and AppTable component.
i want to select some lines and delete them, and after that, the state of the checked lines was empty in state AppTable component.
i declare in parent component state for checked component and pass as props setSelected for update it.
const [selected, setSelected] = useState<number[]>([]);
In child AppTable component i use state for react-table like it describe in example.
const [rowSelection, setRowSelection] = useState({});
The main problem that in parent component i need origin Id to delete rows, in react-table component i need have internal reac-table id.
Demo in sandbox. You can try delete last row and you will see that in header checkbox will still checked.
You can try delete row in middle and you will see that next row will have checked state. It is because child react-table component don't empty state.
Please suggest how to implement the removal of rows from the AppTable component, if the button for deletion is outside this component. After deleting rows, the state of checked rows should be empty
Beta Was this translation helpful? Give feedback.
All reactions