[ 6 posts ]

Hiko Momorin

  • Username: gauze
  • Joined: Fri May 22, 2009 10:55 am
  • Posts: 27
  • IRC: g0z
  • Offline
  • Profile

how to get Highlighted node in Treeview?

Post Posted: Fri Jun 15, 2012 3:18 am
+0-
I have some sample code here: http://work.dropdead.org/filebrowser/

when you highlight a node then mouseover the span that says "Mouseover for Node" it always returns null instead of a reference to the node, what am I doing wrong? Should i be doing something completely different to get the selected/highlighted node?
I'm setting singleNodeHighlight to true as per api reference:

getHighlightedNode
YAHOO.widget.Node getHighlightedNode ( )
When in singleNodeHighlight it returns the node highlighted or null if none. Returns null if singleNodeHighlight is false.

Returns: YAHOO.widget.Node
a node reference or null

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: how to get Highlighted node in Treeview?

Post Posted: Fri Jun 15, 2012 3:46 am
+0-
You are not highlighting the nodes. You have to use onEventToggleHighlight:
http://developer.yahoo.com/yui/docs/YAH ... eHighlight

You must tell TreeView which event you mean to associate with highlighting.

Hiko Momorin

  • Username: gauze
  • Joined: Fri May 22, 2009 10:55 am
  • Posts: 27
  • IRC: g0z
  • Offline
  • Profile

Re: how to get Highlighted node in Treeview?

Post Posted: Fri Jun 15, 2012 4:49 am
+0-
thank you for your answer I've made some headway!

ok now this is weird maybe, but now when I "highlight" with a single click it doesn't visually highlight the node anymore but if you do the mouseover it returns an object reference so it's working now ... except without the visuals, I tried adding

tree.setNodesProperty('enableHighlight', true);

but it didn't help, what else am I missing?

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: how to get Highlighted node in Treeview?

Post Posted: Fri Jun 15, 2012 10:37 am
+0-
You are missing the className that says how you want your highlighting displayed. Highlighting simply adds a className to signal the state of the node. To make that state visible, you have to enclose the whole tree, that is, the div that will contain the tree, and give it any of the two classnames corresponding to the two styles provided. You can use none of them and simply do your own styling. Highlighting in treeview does not force any visual style. Check the examples to see which style suites you the best and if none does, do your own.

Hiko Momorin

  • Username: gauze
  • Joined: Fri May 22, 2009 10:55 am
  • Posts: 27
  • IRC: g0z
  • Offline
  • Profile

Re: how to get Highlighted node in Treeview?

Post Posted: Fri Jun 15, 2012 10:49 am
+0-
ok got it now, thank you.
I'm sure I'll have more treeview questions when I get to dynamic display.

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: how to get Highlighted node in Treeview?

Post Posted: Fri Jun 15, 2012 12:35 pm
+0-
If you read the documentation and check the examples, I think you shouldn't have any more questions. All that I've replied here was in the examples.
  [ 6 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum