Js-easyui初始化树

<body>
<jsp:include page="/av/top.jsp"></jsp:include>
<jsp:include page="/av/module/head.jsp"></jsp:include>
<!-- nav -->
<div class="zsnavigation">aa<img src="av/images/erjidhimg.png" />发布aa</div>
<!-- main -->
<div class="zserjimain">
	<div id="leftTree" class="zsermleft" style="overflow-y:auto ;height:480px;width:199px;border:0px solid black;">
		<ul id="mytree" style="height:190px;"> </ul>  
	</div>
	<div id="rightPage" class="zsermright">
		<iframe id="dynaPage" src="<%=request.getContextPath()%>/av/module/knowledge/knowledgePublish/dynaPage.jsp"  frameborder="0"  width="100%" οnlοad="dyniframesize('dynaPage');"></iframe>
	</div>
</div>
<!-- 
<div id="mm" class="easyui-menu" style="width: 120px;">
	<div οnclick="MenuWin()" iconcls="icon-add">添加子菜单</div>
	<div οnclick="updateMenu()" iconcls="icon-edit">修改</div>
	<div οnclick="delMenu()" iconcls="icon-remove">删除</div>
</div>
 -->
<div id="zhsh_foot">© 2013 </div>

<script type="text/javascript">
var baseurl = '<%=request.getContextPath()%>';

$(function(){
 	loadProcessTree();
 	dyniframesizeDiv("leftTree");
 	window.setTimeout("expand()", 400);
});

function loadProcessTree(id){
	$('#mytree').tree({   
		checkbox: false,   
		lines : true,
		method : 'post',
		iconCls: 'icon-catalog',
	    url:'pl/templateClass/getTemplateClassTreeRoot.json?rootId='+(id==undefined||id==""?"KnowledgeTemplateClass":id),  
	    onBeforeExpand:function(node,param){
	    	 $('#mytree').tree('options').url = "pl/templateClass/getChildNodeWithPrivilege.json?parentId=" + node.id ;
	    	 $('#mytree').tree('update', {
	             target: node.target,
	             iconCls: 'icon-file'
	         });
	    },
	    onClick:function(node){
	    	var b = $("#tree").tree('isLeaf',node.target);
	    	//document.getElementById("listTable").src="pl/template/templateListByclassId?tableName="+node.attributes.tableName;
	    	if(b){
	    		getTemplateForPublish(node);
	    	}else{
	    		getIntroductionInfo(node);
	    	}
      	},
      	onContextMenu: function(e, node){  
            e.preventDefault();  
            $('#mytree').tree('select', node.target);  
            $('#mm').menu('show', {  
                left: e.pageX,  
                top: e.pageY  
            });  
        }
	});
}

function getIntroductionInfo(node){
	expand();
	if(node){
		window.frames['dynaPage'].loadIntroduction(node.id);
	}
}
function getTemplateForPublish(node){
	if(node){
		if(node.attributes && node.attributes.tableName){
			var tableName=node.attributes.tableName;
			window.frames['dynaPage'].loadTemplage(tableName);
		}
	}
}

function expand() {
	var node = $('#mytree').tree('getSelected');
	if(node){
		$('#mytree').tree('expand',node.target);
	}else{
		$('#mytree').tree('expandAll');
	}
}
</script>
</body>

 

/**
	 * 
	 * @return Collection 树的根,
	 * @throws Exception
	 */
	@RequestMapping("/getTemplateClassTreeRoot")
	public void getTreeRoot(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String roodId = request.getParameter("rootId");
		List<KmTemplateClass> classList = templateClassService
				.getTreeRoot(roodId);
		List<BmpCatalogTreeModel> resultList = templateClassService
				.getCatalogTreeDataJson(classList);

		ObjectMapper mapper = new ObjectMapper();
		String dataStr = mapper.writeValueAsString(resultList);
		response.getWriter().write(dataStr);
		response.getWriter().flush();
		response.getWriter().close();
	}


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值