jQuery异步生成树
这个树是用zTree这个插件搞定的!代码如下
页面代码:
Jsp代码
<%@ page language="java" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>jQuery Tree </title>
<link rel="stylesheet" href="zTree/demoStyle/demo.css" type="text/css">
<link rel="stylesheet" href="zTree/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="zTree/jquery-1.4.2.js"></script>
<script type="text/javascript" src="zTree/jquery.ztree-2.6.js"></script>
<SCRIPT LANGUAGE="JavaScript">
var zTree1;
var setting = {
checkable: false,
async: true,
asyncUrl: "Tree", //获取节点数据的URL地址
asyncParam: ["name", "id"], //获取节点数据时,必须的数据名称,例如:id、name
asyncParamOther: ["test","true"] , //其它参数 ( key, value 键值对格式)
callback : {
click: function (event, treeId, treeNode){
// zTree1.expandNode(treeNode, true, false);
} ,
expand : function (event, treeId, treeNode){
},
collapse:function (event, treeId, treeNode){
}
}
};
function refreshTree() {
zTree1
相关新闻>>
- 发表评论
-
- 最新评论 更多>>