2015-10-20 58 views
0

我想在创建时设置节点的类型。这是我想要的:如何在创建时设置节点的类型?

$("#tree").jstree("create_node", parentId, {text: "mynode", id: "myid", type: "mytype"}, "last"); 

这不设置类型。我知道set_type存在,但我想知道节点的创建是否可行。

+0

我相信这个答案,你还会发现你的解决方案:http://stackoverflow.com/questions/6341279/jstree-not-creating-节点的-一个特定类型的 – matan7890

回答

0

你没有表现出你的树全的配置,所以请检查的几件事情:

  1. 你应该在树的配置已经启用types插件作为"plugins": [ "types" ]
  2. 你应该配置types例如像这样:

    "types" : { 
        "tree" : { 
         "icon" : 'https://www.jstree.com/tree-icon.png' 
        }, 
        "mytype" : { 
         "icon" : 'glyphicon glyphicon-leaf' 
        } 
    } 
    

观看演示JS Fiddle

相关问题