我正在尝试使用 jstree。
实际上我正在使用示例:PHP & mySQL 演示 + 事件顺序,您可以在网页上找到:http://www.jstree.com/demo
我需要在树结构中创建一个新类型,因此我在第 059 行添加了以下代码行(在您可以在引用的链接中看到的示例中)
"mytype" : { "valid_children" : "none", "icon" : { "image" :
"./mytype.png" } },
然后在按钮的代码菜单中我还在菜单输入点击函数中添加了这个:
case "add_mynewtype":
$("#demo").jstree("create", null, "last", { "attr" : { "rel" : "mytype" } });
break;
显然我还连接了一个新的输入按钮,如下所示:
<input type="button" id="add_mynewtype" value="Create new type" style="display:block; float:left;"/>
但这不能正常工作......
有人可以帮助我吗? 非常感谢,任何提示都非常感谢
最佳答案
我找到了问题的解决方案。
还需要修改文件夹的声明,如下所示:
"folder" : {
"valid_children" : [ "default", "folder", "mytype" ],
"icon" : {"image" : "./folder.png" }
},
或者:
"folder" : {
"valid_children" : [ "all" ],
"icon" : {"image" : "./folder.png" }
},
关于jquery - JStree 1.0 创建新类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13959631/