随笔 - 147  文章 - 71  trackbacks - 0
<2009年4月>
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

常用链接

留言簿(1)

随笔分类(146)

随笔档案(147)

文章分类(28)

文章档案(28)

喜欢的Blog

搜索

  •  

最新评论

阅读排行榜

评论排行榜

Tree的例子

 1Ext.onReady(function() {
 2            var json = [{
 3                        'text' : 'A',
 4                        'id' : 'a',
 5                        'leaf' : false,
 6                        'children' : [{
 7                                    'text' : 'A1',
 8                                    'id' : 'a1',
 9                                    'leaf' : false,
10                                    'children' : [{
11                                                'text' : 'A11',
12                                                'id' : 'a11',
13                                                'leaf' : true
14                                            }
{
15                                                'text' : 'A12',
16                                                'id' : 'a12',
17                                                'leaf' : true
18                                            }
{
19                                                'text' : 'A13',
20                                                'id' : 'a13',
21                                                'leaf' : true
22                                            }
{
23                                                'text' : 'A14',
24                                                'id' : 'a14',
25                                                'leaf' : true
26                                            }
]
27                                }
{
28                                    'text' : 'A2',
29                                    'id' : 'a2',
30                                    'leaf' : true
31                                }
]
32                    }
{
33                        'text' : 'B1',
34                        'id' : 'b1',
35                        'leaf' : false,
36                        'children' : [{
37                                    'text' : 'B11',
38                                    'id' : 'b11',
39                                    'leaf' : true
40                                }
{
41                                    'text' : 'B11',
42                                    'id' : 'b12',
43                                    'leaf' : false,
44                                    'children' : [{
45                                                'text' : 'B121',
46                                                'id' : 'b121',
47                                                'leaf' : true
48                                            }
]
49                                }
]
50                    }
];
51            var tree = new Ext.tree.TreePanel({
52                        animate : true,
53                        enableDD : false,
54                        loader : new Ext.tree.TreeLoader(),
55                        lines : true,
56                        selModel : new Ext.tree.MultiSelectionModel(),
57                        containerScroll : false
58                    }
);
59
60            var root = new Ext.tree.AsyncTreeNode({
61                        text : 'Autos',
62                        draggable : false,
63                        id : 'source',
64                        children : json
65                    }
);
66
67            tree.setRootNode(root);
68
69            tree.on('click', function(node) {
70                        alert(node.id + "" + node.text);
71                        if (node.leaf == true{
72                            addSelected(node.id, node.text);
73                        }

74                    }
);
75            tree.render(document.body);
76            root.expand();
77
78        }
);
调用:
<div id="tree"></div>
posted on 2009-04-01 20:21 飞翔天使 阅读(1053) 评论(1)  编辑  收藏 所属分类: ajax

FeedBack:
# re: Extjs使用教程(整理中)[未登录] 2012-10-25 14:52 a
defe fer  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: