<script type="text/javascript" src="/plug/treegrid/TableTree4J.js"></script>
<link rel="StyleSheet" href="/plug/treegrid/css/tabletree4j.css" type="text/css" />javascript
<script language="JavaScript">css
//GridTree
var gridTree;
function showGridTree(){
//init
gridTree=new TableTree4J("gridTree","/..");
gridTree.tableDesc="<table border=\"1\" class=\"GridView\" width=\"100%\" id=\"table1\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-collapse: collapse\" bordercolordark=\"#C0C0C0\" bordercolorlight=\"#C0C0C0\" >";
var headerDataList=new Array("類別名稱","描述","排序","是否系統定義"); //列名能夠根據須要自定義
var widthList=new Array("25%","55%","5%","15%");
//參數: arrayHeader,id,headerWidthList,booleanOpen,classStyle,hrefTip,hrefStatusText,icon,iconOpen
gridTree.setHeader(headerDataList,-1,widthList,true,"GridHead","This is a tipTitle of head href!","header status text","","");
//設置列樣式
gridTree.gridHeaderColStyleArray=new Array("","","","centerClo");
gridTree.gridDataCloStyleArray=new Array("","","","centerClo");
//add data 增長數據
var dataList;
<s:iterator value="#request.articleTypelist" status="stuts">
//var dataList=new Array("系統管理","2007-12-10","使用中","","<a href=\"#\">刪除</a> | <a href=\"#\">查看</a> ");
//參數: dataList,id,pid,booleanOpen,order,url,target,hrefTip,hrefStatusText,classStyle,icon,iconOpen
//gridTree.addGirdNode(dataList,1,-1,null,3,"#",null,"hello!","狀態欄文字",null,null,null);
dataList=new Array('<s:property value="name" />','<s:property value="describe" />','<s:property value="sort" />','<s:property value="isSystemDefine==1?'是':'否'" />');
//參數: dataList,id,pid,booleanOpen,order,url,target,hrefTip,hrefStatusText,classStyle,icon,iconOpen
gridTree.addGirdNode(dataList,'<s:property value="id" />','<s:property value="parentID" />',null,3,"#",null,"<s:property value="describe" />","<s:property value="describe" />",null,null,null);java
</s:iterator>
//print
gridTree.printTableTreeToElement("gridTreeDiv");測試
}
</script>url
<!-- 作刷新頁面用-->
<form action="manage/article/view.do" name="form1">
<input type="hidden" value="測試" class="btn_newStyle" />
</form>
<body class="body">
spa
<div id="searchDiv">
<!-- <input type="button" value="打開文章類別管理" onclick="showTree()" /> -->
顯 示 欄
</div>
<div align="right">插件
</div>
<div id="gridTreeBtn" class="btnDiv" >
<span class="items"></span><br/>
<input type="button" value="展現文章類別圖" onclick="showGridTree()" />
<a href="javascript:gridTree.openAllNodes()">展開全部</a> |
<a href="javascript:gridTree.closeAllNodes()">關閉全部</a>
</div>
<div id="gridTreeDiv">orm
</div>排序
<p/>
<p/>ip
<br>
<style>
.body{
font-size:12px;
}
.btnDiv a{
color:#0000FF;
text-decoration: none;
}
.btnDiv a:hover{
color:#CC3300;
text-decoration: underline;
}
.items{
color:#669999;
font-size:14px;
}
.title{
font-size:16px;
font-weight:bold;
}
.copyrightdiv{
font-size:12px;
font-family:"Arial";
color:#C0C0C0;
}
.centerClo {
text-align:center;
}
</style>
用到的插件已經在上一篇文章樹形菜單的附件裏包含了