TreePanel

文档一(recorder.html

文档二(recorder.js):

文档三(get-nodes.ashx

文档四(get-nodes.txt:返回根节点下的一级树

文档(get-subnodes.txt:返回节点下的一级树

 

文档一(recorder.html):

<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 --&gt

 

    <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 --&gt

head>

<body>

 

<div id="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";
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();

});

 

文档三(get-nodes.ashx):

@ 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;

        }

    }

 

}

 

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

}]

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12685933/viewspace-200319/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/12685933/viewspace-200319/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值