Topic: MDBdatatables : clear the selected

cariforef priority asked 1 year 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 1 year 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:

  1. 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.
  2. After adding items to the cart you can use the querySelectorAll function to get all checked elements and manually trigger the click event on them.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB React
  • MDB Version: MDB5 5.0.0
  • Device: MAC
  • Browser: Chrome
  • OS: Mac OSX 15
  • Provided sample code: No
  • Provided link: No