文档一(recorder.html):
文档二(recorder.js):
文档三(get-nodes.ashx):
文档四(get-nodes.txt):返回根节点下的一级树
文档五(get-subnodes.txt):返回子节点下的一级树
文档一(recorder.html):
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;
charset=iso-8859-1">
<title>Reorder
TreePanel</title>
<linkrel="stylesheet"type="text/css"href="../ext-2.0/resources/css/ext-all.css"/>
<linkhref="../ext-2.0/resources/css/xtheme-gray.css"rel="stylesheet"type="text/css"/>
<scripttype="text/javascript"src="../ext-2.0/adapter/ext/ext-base.js"></script>
<!-- ENDLIBS
-->
<scripttype="text/javascript"src="../ext-2.0/ext-all.js"></script>
<scripttype="text/javascript"src="reorder.js"></script>
<!-- Common Styles for
the examples -->
</head>
<body>
<divid="tree-div"style="overflow:auto; height:300px;width:250px;border:1px
solid #c3daf9;"></div>
</body>
</html>
文档二(recorder.js):
/*
* Ext JS Library 2.0.2
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
Ext.SSL_SECURE_URL="/ext-2.0/resources/images/default/s.gif";ITPUB个人空间_k?2NF
Ext.BLANK_IMAGE_URL="/ext-2.0/resources/images/default/s.gif";
Ext.onReady(function(){
// shorthand
varTree = Ext.tree;
vartree =newTree.TreePanel({
el:'tree-div',
useArrows:true,
autoScroll:true,
animate:true,
enableDD:true,
containerScroll:true,
loader:newTree.TreeLoader({
dataUrl:'get-nodes.ashx'
})
});0
// set the root node
varroot =newTree.AsyncTreeNode({
text:'系统管理员',
draggable:false,
id:'source'
});
tree.setRootNode(root);
// render the tree
tree.render();
root.expand();
});
文档三(get-nodes.ashx):
<%@WebHandlerLanguage="C#"Class="Login"%>
usingSystem;
usingSystem.Web;
publicclassLogin:IHttpHandler
{
publicvoidProcessRequest(HttpContextcontext)
{
context.Response.ContentType ="text/plain";
/*
* treePanel中具有子节点的node被单击时会向dataUrl发送请求,格式如下:
* Method:POST
* POSTDATA:node=source(返回根节点下的一级树)
* node=nodeid(返回nodeid节点下的一级树)
*/
stringpostNode = context.Request.Form["node"];
if(!string.IsNullOrEmpty(postNode))
if(postNode =="source")
context.Response.WriteFile(
context.Request.MapPath("get-nodes.txt")
);
else
context.Response.WriteFile(
context.Request.MapPath("get-subnodes.txt")
);
}
publicboolIsReusable
{
get
{
returnfalse;
}
}
}
文档四(get-nodes.txt):返回根节点下的一级树
[{
"text":"管理部",
"id":"\/sext-core.js",
"leaf":true,
"cls":"file"
},{
"text":"质量管理部",
"id":"\/sext-all-debug.js",
"leaf":true,
"cls":"file"
},{
"text":"产品部",
"id":"\/sext-core-debug.js",
"leaf":true,
"cls":"file"
},{
"text":"厂务部",
"id":"\/sresources",
"cls":"folder"
}]
文档五(get-subnodes.txt):返回子节点下的一级树
[{
"text":"秘书",
"id":"\/ssext-core.js",
"leaf":true,
"cls":"file"
},{
"text":"职员",
"id":"\/ssext-all-debug.js",
"leaf":true,
"cls":"file"
},{
"text":"文员",
"id":"\/ssext-core-debug.js",
"leaf":true,
"cls":"file"
}]