Topic: How to get TreeView item data in Tree view plugin

vacant priority asked 2 years ago


Expected behavior

I have an outline tree rendered with tree view plugin, say a structure like this:

[{ name: 'item 1', id: 1, children: [{ name: 'item2', id: 2}], { name: 'item 3', id: 3}]

and when the tree item was clicked, an 'activeItemChange' event was emitted, I want to get id of clicked item.

Actual behavior

The $event object was the DOM element, which is useless, I have no way to bind id (say data-id attribute) to the DOM element, neither no way to fetch id from the DOM element

Resources (screenshots, code snippets etc.)


Michał Duszak staff commented 2 years ago

Thank you for your feedback, we will discuss providing more information in passed event upon this Output emit.


vacant priority answered 2 years ago


When I bind the 'selected' Output, this event does not emit at all


Michał Duszak staff commented 2 years ago

'selected' output emits upon selecting the checkbox (which requires the [selectable] input to be set to true) - if this doesn't work for you, could you please share the code so that I can reproduce this issue?


vacant priority commented 2 years ago

I'm in a hurry so I write a tree view component myself, thanks anyway.



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 Angular
  • MDB Version: MDB5 2.3.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No