question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It might be cleaner to have an onSelect callback that can be placed on the root tree node. It only get’s fired when an item gets selected. A group can only be selected during multi select.

New Api:

type TreeProps = {
  onSelect: () // only get's called when a single item is selected.
}

Then when the tree selects something programmatically, this code can run and does not need to be duplicated.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
pgrodriguescommented, Aug 12, 2022

+1 for this, first thing I was looking out was the onSelect handler from the Tree.

0reactions
jameskerrcommented, May 13, 2022

I’ll reopen this then. Yeah, I can’t think of an easy way to run a function when the node is selected. You’d have to put that code in the onClick handler of NodeRenderer probably, which is not very natural.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to use the onSelect callback from the @naisutech/react-tree
The tree is displayed and operates correctly. I tried the theme property and that works ok. I just cannot get the onSelect callback...
Read more >
How to get an event onselect when using "lightning-tree" in ...
Is there way how we can catch an event from "lightning-tree" ... onselect Aura Action The action triggered when a tree item is...
Read more >
TreeView - onSelect on click of text · Issue #793 - GitHub
Create a sample tree using this link without check boxes and selection mode to single. Implement onSelect event, click on tree node text...
Read more >
Tree - Ant Design
The Tree component is a way of representing the hierarchical relationship between these things. You can also expand, collapse, and select a treeNode...
Read more >
Tree OnSelect Event - Suite 5.0 - DHTMLX Forum
Hi, Currently I'm working on dhtmlxTree object. I've attached onSelect event using attachEvent() api. I'm using XML to load tree data.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found