How do I open all nodes in jquery Jstree?

前端 未结 9 1773
感情败类
感情败类 2021-02-05 00:07

I am using the following code:

$("#treeview").jstree();
$("#treeview").jstree(\'open_all\');

With the following html:

9条回答
  •  不知归路
    2021-02-05 00:46

    all the answers above not work in my workspace. I searched again and find this link(Why doesn't jsTree open_all() work for me?) is helpful, and post my answer:

    jstree version: 3.0.0-bata10

    $(document).ready(function() {
      $("#tree").bind("loaded.jstree", function(event, data) { 
        data.instance.open_all();
      });
      $("#tree").jstree();
    })
    

提交回复
热议问题