TreePanel的使用方法

 

TreePanelTest.html

 

<html>
<head>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../../ext-all.js"></script>
<script language="javascript" type="text/javascript">


Ext.onReady(function(){
 var tree = new Ext.tree.TreePanel({
    animate : true,
    autoScroll : true,
    loader : new Ext.tree.TreeLoader({
      baseParams : {
       myName : "Dangzhao"
      },
      clearOnLoad : false ,
      dataUrl : "http://127.0.0.1:8080/CommonWeb/jsonData.jsp" ,
      listeners : {
       beforeload : function(){alert("beforeLoad")},
       load : function(){alert("load")},
       loadexception : function(){alert("loadexception")}
      },
      preloadChildren : false,
      requestMethod : "POST"
     }),
    el : 'tr',
    enableDD:true
   });
 var root = new Ext.tree.AsyncTreeNode({
     text: 'Tree Root',
     draggable:false,
     id:'0'
    });
 tree.setRootNode(root);
 tree.render();
})


</script>
</head>

<body>
<div id="tr" style="width:300;height:400;top:40;left:120;position:absolute "></div>

</body>
</html>

 

jsonData.jsp

 

<%@page import="java.util.*" %>
[{
 id: 1,
 text: 'A Folder Node',
 leaf: false
},{
 id: 2,
 text: 'A leaf Node',
 leaf: true
}]
<%
Enumeration enm=request.getHeaderNames();
while(enm.hasMoreElements()){
    String key=(String)enm.nextElement();
    System.out.println(key+":"+request.getHeader(key));
}
Map p=request.getParameterMap();
Iterator it=p.keySet().iterator();
while(it.hasNext()){
    String key=(String)it.next();
    System.out.println(key+":"+((String[])p.get(key))[0]);
}
%>

 

 

System.out Information

 

Accept:*/*
Accept-Language:zh-cn
Referer:file://E:\ext-2.0.2\ext-2.0.2\examples\grid\TreePanelTest.html
x-requested-with:XMLHttpRequest
Content-Type:application/x-www-form-urlencoded
Accept-Encoding:gzip, deflate
User-Agent:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Host:127.0.0.1:7001
Content-Length:22
Connection:Keep-Alive
Cache-Control:no-cache
Cookie:2=1; 74=1; JSESSIONID=LvpgLBNZ!-832179795
node:0
myName:Dangzhao

 

Show 一下Ext Tree的魅力

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值