1
我想爲關閉和展開添加一個文件夾打開關閉圖標,併爲葉節點添加一個葉子圖標。自定義js樹上的圖標
請幫
編輯:
嘗試添加該類型的插件,但似乎並沒有工作。
var data = {
'core': {
'data': dataObj
},
"search": {
"case_insensitive": true,
"show_only_matches": true
},
"plugins": ["search", "themes"]
};
$('#jstree_category').jstree(data);
$('#jstree_category').on("loaded.jstree", function (e, data) {
_this.treeLoaded = true;
if (!_this.dataFetched) {
return;
}
});
// bind customize icon change function in jsTree open_node event.
$('#jstree_category').on('open_node.jstree', function (e, data) {
$('#' + data.node.id).find('i.jstree-icon.jstree-themeicon').first()
.removeClass('glyphicon glyphicon-folder-close').addClass('glyphicon glyphicon-folder-open');
$('#' + data.node.id).find('i.jstree-icon.jstree-themeicon')
.addClass('glyphicon glyphicon-leaf');
});
// bind customize icon change function in jsTree close_node event.
$('#jstree_category').on('close_node.jstree', function (e, data) {
$('#' + data.node.id).find('i.jstree-icon.jstree-themeicon').first()
.removeClass('glyphicon glyphicon-folder-open').addClass('glyphicon glyphicon-folder-close');
$('#' + data.node.id).find('i.jstree-icon.jstree-themeicon')
.addClass('glyphicon glyphicon-leaf');
});
大小提琴!謝謝 –