【问题标题】:JStree 1.0 create new typeJStree 1.0 创建新类型
【发布时间】:2023-03-26 04:13:01
【问题描述】:

我正在尝试使用 jstree。

其实我用的是例子:PHP & mySQL demo + event order,你可以在网页上找到:http://www.jstree.com/demo

我需要在树结构中创建一个新类型,因此我在第 059 行添加了以下代码行(在引用链接中可以看到的示例中)

 "mytype" : { "valid_children" : "none", "icon" : { "image" :
 "./mytype.png" } },

然后在按钮的代码菜单中我也在mmenu输入点击功能中添加了这个:

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;"/>

但这不能正常工作....

有人可以帮助我吗? 非常感谢,任何提示都非常感谢

【问题讨论】:

    标签: jquery tree nodes jstree tree-nodes


    【解决方案1】:

    我找到了问题的解决方案。

    还需要修改文件夹的声明,如下所示:

    "folder" : {
                "valid_children" : [ "default", "folder", "mytype" ],
                "icon" : {"image" : "./folder.png" }
            },
    

    或:

    "folder" : {
                "valid_children" : [ "all" ],
                "icon" : {"image" : "./folder.png" }
            },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多