Topic: MDB Treeview questions
Tbdx23 free asked 4 years ago
Hello.
I would have 4 questions.
Is there any comprehensive documentation about the treeview component, eg. classes, options that are available?
How can I get in my JS script the items in the tree that a user clicked on?
How can I make the tree to be expanded by default (or the first level expanded, the second not)?
Can I pass the tree as a JS array, or only as HTML?
Tbdx23 free answered 4 years ago
Thank you.
All documentation we have is available on our website.
Could I ask for a link?
You need to add click event listeners to them.
Oh, yes, I asked my question wrongly. By default only one element in the tree can be chosen. My question is, how to read, which one is it.
And additional question: in some branches I need ability to do multiple choice, and in others ability to chose just one within a single branch (with one already chosen by default). So one within a single branch, but there could be eg. 5 different branches, then in total 5 selections. How can that be done?
Grzegorz Bujański staff commented 4 years ago
Link to docs: https://mdbootstrap.com/plugins/jquery/treeview/
By default, multiple choice functionality is not provided. You could theoretically try to add an opened
class to each item after clicking and then use this class to check if the element was "selected", but we cannot guarantee that it will work correctly.
This component has been designed for navigation on the page or elements such as dashboard, admin panel or user settings.
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 jQuery
- MDB Version: 4.19.1
- Device: PC
- Browser: Chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: No
Grzegorz Bujański staff commented 4 years ago
Hi.
rotate
class tothe fa-angle-right
icon and theactive
class to the list that should be expanded by default.