Touch the future...

TreePanel

上一篇 / 下一篇  2008-03-05 08:08:13 / 个人分类:Ext Javascript Library

文档一(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"

}]

 

 


相关阅读:

TAG: ashx ext treepanel

引用 删除 Guest   /   2008-11-13 16:38:24
5
引用 删除 Guest   /   2008-04-13 13:20:30
5
 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2008-12-05  
 123456
78910111213
14151617181920
21222324252627
28293031   

数据统计

  • 访问量: 1337
  • 日志数: 25
  • 文件数: 1
  • 书签数: 18
  • 建立时间: 2008-01-08
  • 更新时间: 2008-09-11

RSS订阅

Open Toolbar