速度和 ztree 对我来说都是新技术。我已经阅读了有关速度和 ztree 的信息。我的问题是如何用 ztree 显示我的输出。请给我建议。。
这是我的代码...
<html>
<head>
#[[
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="tree/demo.css" type="text/css">
<link rel="stylesheet" href="tree/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="tree/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="tree/js/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript">
</script>
<script type="text/javascript">
function toggle(t) {
if(document.getElementById("div"+t).style.display == "none") {
document.getElementById("div"+t).style.display = "block";
document.getElementById("imgMinus"+t).style.display = "block";
document.getElementById("imgPlus"+t).style.display = "none";
} else {
document.getElementById("div"+t).style.display = "none";
document.getElementById("imgMinus"+t).style.display = "none";
document.getElementById("imgPlus"+t).style.display = "block";
}
}
</script>
<SCRIPT type="text/javascript">
<!--
var setting = {
data: {
simpleData: {
enable: true
}
}
};
var zNodes =[
{ id:1, pId:0, name:"pNode 1", open:true},
{ id:11, pId:1, name:"pNode 11"},
{ id:111, pId:11, name:"leaf node 111"},
{ id:112, pId:11, name:"leaf node 112"},
{ id:113, pId:11, name:"leaf node 113"},
{ id:114, pId:11, name:"leaf node 114"},
{ id:12, pId:1, name:"pNode 12"},
{ id:121, pId:12, name:"leaf node 121"},
];
$(document).ready(function(){
$.fn.zTree.init($("#treeDemo"), setting, zNodes);
});
//-->
</SCRIPT>
]]#
</head>
<body>
<div class="content_wrap">
<div>
<ul id="treeDemo" class="ztree"></ul>
</div>
</div>
#set( $countId = 0 )
#createSVNIndexHtml($logEntryList)
</body>
</html>
#macro(createSVNIndexHtml $logEntryList)
#foreach ($child in $logEntryList)
#set( $countId = $countId + 1 )
#if( $child.childNodes.size() > 0 )
<li>
#else
<li>
#end
<table>
<tr>
<td>
#if( $child.childNodes.size() > 0 )
<img id="imgMinus$countId" onclick="toggle('$countId')" src="#if($path)$path\tree\img\Minus.gif#{else}.\Config\img\Minus.gif#end" />
<img id="imgPlus$countId" style="display:none;" onclick="toggle('$countId')" src="#if($path)$path\tree\img\Plus.gif#{else}.\Config\img\Plus.gif#end" />
#end
#set( $fileName = "log/$child.fileName")
</td>
<td>
<a href="$fileName">$child.name</a>
</td>
</tr>
</table>
#if( $child.childNodes.size() > 0 )
<ul id="div$countId" class="ztree">
#createSVNIndexHtml($child.childNodes)
</ul>
#end
</li>
#end
#end
*注意:*我已经使用此代码获得了树视图(不包括从 ztree 示例复制的 zTree 脚本)