Skip to content
Advertisement

filter antd table according to its columns

First of all english is not my mother language so there might be mistakes. I started react with hooks since everybody said its easier, here i have antd table and a button (bootstrap 5 modal), this modal contains 6 buttons (id, title, firstname, lastname, Choose all, confirm your selection), my point is user chooses from ID, Title, firstname, lastname, when user has chosen he clicks’Confirm your selections’ then if he chose for example ‘FirstName and LastName’ then those other columns except these two gets deleted/display:none?? from table then again if he wants those columns back he choose ‘Choose all or just select them’ and click ‘confirm your selection’. Been looking from antd site but they didnt have that, any suggestions?

here my code:

JavaScript

JavaScript

enter image description here

enter image description here

Advertisement

Answer

I’ve implemented what you wanted at CodeSandbox.

I’ve implemented checkbox selection instead of button selection, which feels more convenient.

Demo: enter image description here

Advertisement