---
title: "extjs two tree 动态双树代码 效果图"
author: "atgoingguoat"
date: "2010-03-27T18:56:20Z"
tags: ["EXT", "JSP"]
categories: ["Web前端"]
slug: "extjs-two-tree"
draft: false
lastmod: "2010-03-27T19:00:35Z"
id: 626178
url: "https://atgoingguoat.iteye.com/blog/626178"
---

extjs3.1 tree 代码 ,这是根据官方网站 two\_tree.js 方式修改的。自己生成了动态生成树。

其它动态生成树有很多种方式：

1：官方的 DwrTree 调用 后台类，extjs 会自动封装好数据给前吧。

 

```
tree = new Ext.tree.TreePanel({   
    loader: new Ext.ux.DWRTreeLoader({dwrMethod: Param.getTree}),   
    autoScroll:true,   
    root:new Ext.tree.AsyncTreeNode({text:'根结点,id:'0'})   
});  
```

 

 

2：自己封装数据，生成特定格式的文本。

 

```
new Ext.tree.TreeLoader({
                    dataUrl:'../jsp/get-nodes.jsp',
                    baseParams: {lib:'two'}
                }),
```

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

效果图

 

![](http://dl.iteye.com/upload/attachment/225417/ce955cab-3558-32d8-8849-5b0bb6c30e0e.jpg)