How to get the currently oriented node in a yui TreeView

I need to keep that node currently has focus in the yui TreeView component. I thought there would be a way to find which node has focus at any given time, but cannot find it.

Does anyone know if such a method exists, or otherwise suggests a way to do this?

thanks in advance,

+1


source to share


1 answer


The next (2.7) version of TreeView will have a TreeView.currentFocus property that will point to the Node with focus.

In 2.6 one option is to use Dom's getElementsByClassName and HTML search the tree for any element with class name "ygtvfocus" and then use the TreeView getNodeByElement method, which should tell you which Node was.



At least two elements will be returned with class focusName, one being the toggle icon and the other being the label. Any of them will do this, just remember that this is the array you have.

+4


source







All Articles