我一直在我正在从事的一个项目中使用“Fancytree”,直到今天为止我对它非常满意。我需要在树中的某些节点上显示不同的图标,但到目前为止,还无法让它们显示在树上。
我在 JSON 字符串中指定自定义节点图标,我用它来加载树:
[{
"title": "Inventory",
"key": "DocFolders/1026",
"folder": true,
"data": {
"icon": "LockedFolder.gif",
"isLocked": true
}
}, {
"title": "Telemetry",
"key": "DocFolders/1027",
"folder": true,
"data": {
"icon": "LockedFolder.gif",
"isLocked": true
}
}, {
"title": "Well Documents",
"key": "DocFolders/1028",
"folder": true,
"data": {
"icon": "LockedFolder.gif",
"isLocked": true
},
"expanded": true,
"children": [{
"title": "4-13 Spectrum Core PG&E Data.xlsx",
"key": "SpectrumDocs/961"
}]
}, {
"title": "Well Photos",
"key": "DocFolders/1029",
"folder": true,
"data": {
"icon": "LockedFolder.gif",
"isLocked": true
}
}]
Run Code Online (Sandbox Code Playgroud)
以下是加载树的 …