Topic: MDBdatatables : clear the selected
cariforef free asked 2 years ago
Hello,
I would like to create a cart and fill it with the selected row. Then I want to unselected everything after adding to cart. How can I manage this ? thanks.
Didier
Krzysztof Wilk staff answered 2 years ago
Hi!
You can create a state with the selected row data, use the onSelectRow
event to get the row user desires and display it in the cart.
There are no options in the component to uncheck everything in the table, so there are 2 options:
- You can store the data for the table in the state and after adding them to the cart you can set the state again to defaults. That should rerender the component and uncheck everything.
- After adding items to the cart you can use the
querySelectorAll
function to get all checked elements and manually trigger theclick
event on them.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB React
- MDB Version: MDB5 5.0.0
- Device: MAC
- Browser: Chrome
- OS: Mac OSX 15
- Provided sample code: No
- Provided link: No