dtree ajax
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <script src="jquery-1.4.2.min.js"></script> <link rel="StyleSheet" href="dtree.css" type="text/css" /> <script type="text/javascript" src="dtree.js"></script> <script type="text/javascript"> $(document).ready(function(){ //获取顶级部门 d = new dTree('d'); d.add(0,-1,'系统'); $.ajaxSetup({cache:false}); $.getJSON("getTreeNode.action",function call(data){ var org=eval("("+data+")"); // alert(org.length); for(var i=0;i<org.length;i++){ // alert(org[0].id); //id, pid, name, url, title, target, icon, iconOpen, open d.add(org[i].id,0,org[i].desc,"javascript:addNextOrg('"+org[i].id+"');",'测试节点'); } $("#showDtree").html(d.toString()); }); }); //获取下级部门 function addNextOrg(ID){ $.getJSON("getTreeNode.action?id="+ID,function call(data){ // alert(data); var org1=eval("("+data+")"); alert(org1.length); if(org1.length!=0){ for(var i=0;i<org1.length;i++){ alert(org1[i].id); d.add(org1[i].id,ID,org1[i].desc,"javascript:addNextOrg('"+org1[i].id+"');",'测试节点'); } $("#showDtree").html(d.toString()); } }); } /* function showformDiv(id){ $('.formDiv').hide(); $(id).show(); } function buildOrg(){ var str=$("#buildOrg").serialize(); alert(str); $.getJSON("/simple/DynajetServlet?Method=buildOrg&"+str,function call(data){ var result=data.result; // alert("hello"); $("#result").text(result); }); }*/ /* function orgChange(){ $.ajaxSetup({cache:false}); var orgId=$("#orgList").val(); alert(orgId); $.getJSON("/simple/SalesServlet?Method=getRoleJson&orgId="+orgId,function call(data){ var continents =data.roleList; for(var i=0;i<continents.length;i++){ $("#roleList").append('<option value='+continents[i].roleId+'>'+continents[i].description+'</option>'); } }); } */ </script> </head> <body> <div id="showDtree"> </div> </body> </html>
相关推荐
kentrl 2020-11-10
结束数据方法的参数,该如何定义?-- 集合为自定义实体类中的结合属性,有几个实体类,改变下标就行了。<input id="add" type="button" value="新增visitor&quo
ajaxyan 2020-11-09
zndy0 2020-11-03
学留痕 2020-09-20
Richardxx 2020-11-09
learningever 2020-09-19
chongxiaocheng 2020-08-16
ajaxhe 2020-08-16
lyqdanang 2020-08-16
curiousL 2020-08-03
TONIYH 2020-07-22
时光如瑾雨微凉 2020-07-19
83510998 2020-07-18
坚持着执着 2020-07-16
jiaguoquan00 2020-07-07
李永毅 2020-07-05
坚持着执着 2020-07-05