Topic: Best way to associate data with MDBTreeviewItem

Larry White free asked 5 years ago


I'm trying to understand how the treeview is supposed to be used.

I need to use it for navigation so I need each item to be associated with a unique id, and not just the text string in the title property. The title could be the same at two different places in the tree.

It seems to me that MDBTreeviewItem should hold an object like the option in a select with both a text display and a value that could be a unique id, but I must be missing something since getValue() just returns the title. How should I do this?

Thanks very much.


Jakub Chmura staff answered 5 years ago


Hi @Larry White,

GetValue() returns 2 elements. Item and value. Value returns the title of the property. Item returns a rendered element. If you set a unique ID to element in treeview you can get this id from item, because you have access to all attributes of this element.

item attributes

Best, Kuba



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: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.22.1
  • Device: any
  • Browser: any
  • OS: any
  • Provided sample code: No
  • Provided link: No