1

How to add class to li tag in fancy tree jquery.
I tried using extraClasses but it adds the class to the span tag can anyone help me?

 {title: "Node 2", folder: true, lazy: true, 
        treeMode: "struct", 
        keyType: "root", key: "_structtree_", 
        refKey: "_structtree_", 
        extraClasses: "scioStructureTree" }

Please :)

1 Answers1

3

I've had a similar problem when restyling fancytree. I have found a solution after studying the source code of fancytree

$("<selector to your html element>").fancytree({
   ... other stuff ...
   renderNode: function(event, data) {
      setTimeout(function() {
          $(node.li).addClass("your className")
      }, 20);
   }
})

The 20 ms timeout makes sure that the node is fully rendered, so the classes aren't removed with the rendering.

You can use node.li as a normal javascript object, $(node.li) as a normal JQuery object

jedemu115
  • 161
  • 8