jsTree 3中的自定义图标?

现在

我试图用“类型”插件将自定义图标添加到节点,但是它不起作用或通过“图标”字段,但是我不能从“自动”值更改背景大小。谁能帮我。

$("#jstree")
        .on("ready.jstree", function (e, data) {
            $('div#jstree li > a[rel="disabled"] i.jstree-checkbox').remove();
        })
        .on("open_node.jstree", function (e, data) {
            $('div#jstree li > a[rel="disabled"] i.jstree-checkbox').remove();
        })
        .jstree({
        "core": {
            "data": { "url": "/Home/TreeData" }
        },
        "types": {
            "boss": {
                "icon": "/Content/jsTree/boss.png"
            }
        },
        "plugins": ['checkbox', 'theme', "html_data"]
    });

json:

[{"id":null,
  "text":"Root",
  "icon":"/Content/jsTree/boss.png",
  "state":null,
  "children":
    [{"id":null,
      "text":"Leaf A",
      "icon":null,
      "state":null,
      "children":null,
      "li_attr":{"rel":"boss"},
      "a_attr":null},
     {"id":null,
      "text":"Leaf B",
      "icon":null,
      "state":null,
      "children":null,
      "li_attr":null,
      "a_attr":{"rel":"boss"}},
     {"id":null,
      "text":"Leaf C",
      "icon":null,
      "state":null,
      "children":null,
      "li_attr":null,
      "a_attr":{"rel":"disabled"}
     }],
  "li_attr":null,
  "a_attr":null
}]
法兰克·瓦伦丁

您需要在插件列表中添加“类型”插件:

"plugins": ['checkbox', 'theme', "html_data", "types"]

您还需要在节点的数据中提供type属性(而不是使用li_attr):

[{"id":null,
  "text":"Root",
  "icon":"/Content/jsTree/boss.png",
  "state":null,
  "type":"boss"
  ...

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

自定义jsTree CSS样式

来自分类Dev

jstree自定义节点标记

来自分类Dev

jstree angular指令中不同节点的自定义Contexmenu

来自分类Dev

TypeScript中的JsTree自定义上下文菜单

来自分类Dev

具有自定义json数据的JsTree

来自分类Dev

将自定义类添加到jstree

来自分类Dev

触发contextmenu自定义事件后jsTree错误

来自分类Dev

单击jstree更改图标

来自分类Dev

在 Jstree 中展开后的图标变化

来自分类Dev

Java中的jstree递归副本

来自分类Dev

隐藏JSTree中的特定节点

来自分类Dev

JSTree防止从类中拖动

来自分类Dev

JSTree 未显示在容器中

来自分类Dev

如何在jsTree树顶部放置图标

来自分类Dev

jsTree使用替代的JSON格式和AJAX自定义<li>

来自分类Dev

带有超棒字体的jsTree树中的节点图标

来自分类Dev

无法从IE中的jsTree中删除元素

来自分类Dev

jQuery函数在jstree中查找节点的状态?

来自分类Dev

jstree从树中获取新的json数据

来自分类Dev

在jsTree中更改节点文本

来自分类Dev

仅显示jsTree中匹配的节点

来自分类Dev

在JQuery JStree中获取选中的元素

来自分类Dev

从JsTree选择中填充文本字段

来自分类Dev

如何在 jstree 插件中禁用折叠

来自分类Dev

如何在jstree 3中显示叶节点的文件状图标

来自分类Dev

使用jstree ui时,如何单击jstree中的叶节点以打开其超链接?

来自分类Dev

jsTree 3-如何预先检查项目而不选择它

来自分类Dev

单击+时使用Ajax加载jsTree v3

来自分类Dev

自定义searchview中的关闭图标