tree

1:ztree 国产插件,文档全,上手快

      url:http://www.ztree.me/v3/main.php#_zTreeInfo

2:dhtmlxTree  也还 不错

        遇到的问题:当在地址栏回车时会调用两次方法,导致根出现两次

    

<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link href="${cssPath}/index.css" rel="stylesheet" type="text/css" />
<link rel="STYLESHEET" type="text/css" href="${jsPath}/dhtmltree/codebase/dhtmlxtree.css">
<script src="${jsPath}/dhtmltree/codebase/dhtmlxcommon.js" /></script>
<script src="${jsPath}/dhtmltree/codebase/dhtmlxtree.js" /></script>
<script src="${jsPath}/dhtmltree/codebase/ext/dhtmlxtree_sb.js" /></script>
<style>
table
{
	table-layout: auto;
}
</style>
</head>
<body bgcolor="#ebebeb">
<div id="treeboxbox_tree" style="text-align: left;width:240;margin-top:5px; height:99%;background-color:#f5f5f5;border :1px solid Silver;"></div>

	<script>
		function doOnClick(itemId)
		{
			var myUrl = tree.getUserData(itemId,"myurl");
			if(myUrl)
			{
				myUrl = basePath+myUrl;
				top.frames["rightFrame"].location.href = myUrl;// or frames[“someframe“].location.href = myUrl
			}
		}
		var tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
		tree.setImagePath("<%=imgPath%>dtreeIcon/");
		tree.setOnClickHandler(doOnClick);
		tree.setXMLAutoLoading("${ctx}/res/queryRes/getResXml.do");
		tree.loadXML("${ctx}/res/queryRes/getResXml.do");
		function treeReload()
		{

			//tree.refreshItem();   //注掉后,后台只调一次,问题解决
		}

	</script>
</body>
</html>

 传入的xml:

<tree id="0">
<item id="1" text="资源树">
<userdata name="myurl">menu/resIndex.do</userdata>
<item id="hw0" text="设备" open="1">
<userdata name="myurl">menu/resIndex.do?deviceType=1</userdata>
<item id="other_pc(2)" text="other_pc(2)">
<item id="14358" text="CCN-BJ-J-5KV" im0="../systemico/linux.gif">
<userdata name="myurl">res/resLoad/resSnmpHost.do?resId=14358</userdata>
<userdata name="imgName">../systemico/linux.gif</userdata>
</item>
<item id="14144" text="CCN-BJ-J-5KX" im0="../systemico/linux.gif">
<userdata name="myurl">res/resLoad/resSnmpHost.do?resId=14144</userdata>
<userdata name="imgName">../systemico/linux.gif</userdata>
</item>
</item>
</item>
<item id="sw0" text="软件" open="1">
<userdata name="myurl">menu/resIndex.do?deviceType=2</userdata>
<item id="7" text="Enterprise System Manager " im0="../systemico/esm.gif">
<userdata name="myurl">resesm/resesm.do?resId=7</userdata>
<userdata name="imgName">../systemico/esm.gif</userdata>
</item>
<item id="14825" text="106.3.42.192 Tomcat Apache Tomcat/6.0.37" im0="../systemico/tomcat.gif">
<userdata name="myurl">restomcat/restomcat.do?resId=14825</userdata>
<userdata name="imgName">../systemico/tomcat.gif</userdata>
</item>
<item id="15652" text="106.3.42.194 Tomcat Apache Tomcat/6.0.18" im0="../systemico/tomcat.gif">
<userdata name="myurl">restomcat/restomcat.do?resId=15652</userdata>
<userdata name="imgName">../systemico/tomcat.gif</userdata>
</item>
<item id="70873" text="106.3.42.194 Oracle 10g" im0="../systemico/oracle.gif">
<userdata name="myurl">resoracle/resoracle.do?resId=70873</userdata>
<userdata name="imgName">../systemico/oracle.gif</userdata>
</item>
<item id="15054" text="223.202.45.70 Oracle 10g" im0="../systemico/oracle.gif">
<userdata name="myurl">resoracle/resoracle.do?resId=15054</userdata>
<userdata name="imgName">../systemico/oracle.gif</userdata>
</item>
<item id="25289" text="mas URL Monitor " im0="../systemico/url.gif">
<userdata name="myurl">urlMonitor/detail.do?resId=25289</userdata>
<userdata name="imgName">../systemico/url.gif</userdata>
</item>
</item>
</item>
</tree>

 问题图片:

   
tree
 

 

你可能感兴趣的:(tree)