文档五(get-subnodes.txt):返回子节点下的一级树
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Reorder TreePaneltitle>
<link rel="stylesheet" type="text/css" href="../ext-2.0/resources/css/ext-all.css" />
<link href="../ext-2.0/resources/css/xtheme-gray.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../ext-2.0/adapter/ext/ext-base.js">script>
<!-- ENDLIBS -->
<script type="text/javascript" src="../ext-2.0/ext-all.js">script>
<script type="text/javascript" src="reorder.js">script>
<!-- Common Styles for the examples -->
head>
<body>
<div id="tree-div" style="overflow:auto; height:300px;width:250px;border:1px solid #c3daf9;">div>
body>
html>
/*
* 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";
Ext.BLANK_IMAGE_URL="/ext-2.0/resources/images/default/s.gif";
Ext.onReady(function(){
// shorthand
var Tree = Ext.tree;
var tree = new Tree.TreePanel({
el:'tree-div',
useArrows:true,
autoScroll:true,
animate:true,
enableDD:true,
containerScroll: true,
loader: new Tree.TreeLoader({
dataUrl:'get-nodes.ashx'
})
});0
// set the root node
var root = new Tree.AsyncTreeNode({
text: '系统管理员',
draggable:false,
id:'source'
});
tree.setRootNode(root);
// render the tree
tree.render();
root.expand();
});
@ WebHandler Language="C#" Class="Login" %>
using System;
using System.Web;
public class Login : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
/*
* treePanel 中具有子节点的node被单击时会向dataUrl发送请求,格式如下:
* Method:POST
* POSTDATA:node=source(返回根节点下的一级树)
* node=nodeid(返回nodeid节点下的一级树)
*/
string postNode = 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")
);
}
public bool IsReusable
{
get
{
return false;
}
}
}
[{
"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"
}]
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12685933/viewspace-200319/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/12685933/viewspace-200319/