参考示例:自定义节点
<ul id="tree1" class="mini-tree" url="../data/tree.txt" style="width:200px;padding:5px;" showTreeIcon="true" textField="text" idField="id" ondrawnode="onDrawNode" showCheckBox="true" > </ul>
此时,我们监听了“drawnode”事件。
function onDrawNode(e) { var tree = e.sender; var node = e.node; var hasChildren = tree.hasChildren(node); //所有子节点加上超链接 if (hasChildren == false) { e.nodeHtml = '<a href="http://www.miniui.com/api/' + node.id + '.html" target="_blank">' + node.text + '</a>'; } //父节点高亮显示;子节点斜线、蓝色、下划线显示 if (hasChildren == true) { e.nodeStyle = 'font-weight:bold;'; } else { e.nodeStyle = "font-style:italic;"; //nodeStyle e.nodeCls = "blueColor"; //nodeCls } //修改默认的父子节点图标 if (hasChildren == true) { e.iconCls = "folder"; } else { e.iconCls = "file"; } //父节点的CheckBox全部隐藏 if (hasChildren == true) { e.showCheckBox = false; } }