react-bootstrap-table2
react-bootstrap-table2 copied to clipboard
Togggle List not Work on Custom Dropdown
Question Hello guys, please help i already following this instruction, but mine is not working well. Maybe something I left behind my works.
codesandbox https://codesandbox.io/s/async-morning-juy0t
Could you provide a code sandbox with your implementation?
@Ymbere already attached on this issue
@muhammad-ihsan I could not see any problems in your code, this seems to be an issue with the toolkit provider.
When you toggle the dropdown the component re-renders, causing the reset of the internal state.
I think that for a workaround maybe you could manage the selected columns in your state instead.
I've created this example showing how you can implement it, It's made using functional components but you can adapt it to your case.
The catch is in the function customHandleToggleColumnVisibility and in the use of the property hidden in the table columns.
You can check in the console that the component re-renders and the state is not lost in the process
Hope it helps