Icons JStree3中的自定义图标?
我曾尝试使用“类型”插件向节点添加自定义图标,但它不起作用或通过“图标”字段,但我无法更改“自动”值的背景大小。 谁能帮帮我吗Icons JStree3中的自定义图标?,icons,jstree,Icons,Jstree,我曾尝试使用“类型”插件向节点添加自定义图标,但它不起作用或通过“图标”字段,但我无法更改“自动”值的背景大小。 谁能帮帮我吗 $("#jstree") .on("ready.jstree", function (e, data) { $('div#jstree li > a[rel="disabled"] i.jstree-checkbox').remove(); }) .on("open_node.jstree",
$("#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:
您需要在插件列表中添加“类型”插件:
"plugins": ['checkbox', 'theme', "html_data", "types"]
您还需要在节点的数据中提供类型属性(而不是使用li_attr):
所以你需要用相同的图标为每个元素重复整个url?这不可能是答案…@Matthieuchabonnier,不是真的。对于自定义图标设置,它设计为在两种模式下工作:1)为元素传递表示CSS类的字符串,或2)为类型的图标传递地址。因此,一旦用自定义图标声明了一个类型,您就只需重复这个类型名称,而不是整个url。顺便说一句,我无法使它与CSS类+背景图像(仅glyphicon)一起工作,这很奇怪。
"plugins": ['checkbox', 'theme', "html_data", "types"]
[{"id":null,
"text":"Root",
"icon":"/Content/jsTree/boss.png",
"state":null,
"type":"boss"
...