Topic: Treeview with dynamic data
arnaud.lallain pro premium priority asked 3 years ago
Hello,
We are trying to use treeview with dynamic data, but we cannot find anything about that in the documentation,
There is a library https://github.com/jonmiles/bootstrap-treeview, and it works using : $('#treeView').treeview({ data: data.data, enableLinks: true });
Is there something similar in the mdb treeview ?
Thank you,
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Open
- User: Pro
- Premium support: Yes
- Technology: MDB jQuery
- MDB Version: MDB4 4.5.0
- Device: Laptop
- Browser: Chrome
- OS: Windows
- Provided sample code: No
- Provided link: Yes
Mikołaj Smoleński staff commented 3 years ago
In such case I suggest to use the latest MDB5 Treeview plugin, which has an optional JavaScript initialization and there is an option to update data structure after the dynamic data changes.
Here's the documentation: https://mdbootstrap.com/docs/standard/plugins/tree-view/
Keep coding, Mikołaj from MDB
arnaud.lallain pro premium priority commented 3 years ago
So if I am getting this right, there is no way we can acheive that using the MDB4 ?
Mikołaj Smoleński staff commented 3 years ago
Treeview in MDB4 works only for the HTML elements. To load dynamic data you will have to: 1. Fetch the data via JS 2. Create HTML elements via JS with the same template as static HTML treeview structure. 3. Init the Treeview plugin
Keep coding, Mikołaj from MDB