2

I have something like this :

-Root 1
--Folder 1
--Folder 2
---Element 1
-Root 2
--Folder 3
---Folder 4
----Element 2

I have a 'select' listener for elements and I need to choose the name or key of Root 1 or Root 2 when I choose Element 1 or Element 2 accordingly.

is $("#tree").fancytree("getRootNode") the right way and what exactly should I use to retrieve this information?

4dgaurav
  • 11,360
  • 4
  • 32
  • 59
VIPC
  • 39
  • 2
  • 7

1 Answers1

1

You can access the node and its parent in the event handler using node.getParentList():

select: function(event, data) {
    var parentNode = data.node.getParent(),
        topNode = data.node.getParentList()[0];
}
mar10
  • 14,320
  • 5
  • 39
  • 64