Topic: How to dynamically update MDBootstrap DataTable content via AJAX without page refresh?
Janet729Shires
free
asked 1 week ago
Expected behavior
Actual behavior
Resources (screenshots, code snippets etc.) Hello MDBootstrap Community,
I'm working on a project using MDBootstrap and I have a specific challenge with the DataTable component. I need to update the table's content dynamically based on user interactions (e.g., filter selections, search inputs) without performing a full page refresh. The data for the table is fetched via an AJAX call to a REST API.
Currently, I'm struggling to properly reinitialize or update the DataTable instance after new data is loaded from the AJAX request. I've tried clearing the table body and appending new rows, but this often breaks the DataTable's built-in functionalities like pagination, sorting, and search.
Could someone provide guidance or a code example on the best practice for:
Fetching new data via AJAX.
Dynamically updating an existing MDBootstrap DataTable instance with this new data.
Ensuring all DataTable features (pagination, sorting, search, etc.) remain fully functional after the update.
Any advice, code snippets, or links to relevant MDBootstrap documentation/tutorials on this specific use case would be greatly appreciated!
Thank you in advance for your help.
Mateusz Lazaru
staff
answered 2 days ago
There is an example in the documentation: https://mdbootstrap.com/docs/react/data/datatables/#section-async-data
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 8.0.0
- Device: kiahjd
- Browser: jsutfs
- OS: laoisr
- Provided sample code: No
- Provided link: No