1
votes

I have a problem in expanding my root node by default. I want to expand root node when tree loaded.

I tried with the max depth but not working

1

1 Answers

0
votes

If you load the fancytree data with json then you can pass the option

expanded: true

to the root node then your problem should be solved.

Example:

var test = [  
   {  
      "title":"Root",
      "expanded":true,
      "key":1,
      "folder":true,
      "children":[  
         {  
            "title":"Record",
            "key":2,
            "folder":true,
         }
      ],
   }
];

$(function(){
    $("#tree").fancytree({
        checkbox: false,
        clickFolderMode: 3,
        icon: true,
        source: test
    });
});

Result: enter image description here