extjs ext.tree.panel 添加监听事件

 EXTJS的树,如下方式添加事件,可以响应选择改变、单击,但双击没有响应。而且在选择改变时,同时也会触发单击事件。

问题出在哪里?

var treestore = Ext.create('Ext.data.TreeStore', {
 2     root: {
 3         text:"集团",
 4         id: 'org01',
 5         checked: true,
 6         expanded: true,
 7         children: [
 8             { text: "华南区", id: 'org02', expanded: true},
 9             { text: "华东区", id: 'org03', expanded: true, children: [
10                 { text: "江苏", id: 'org031', leaf: true},
11                 { text: "浙江",  id: 'org032', leaf: true}
12             ] },
13             { text: "华北区",  id: 'org04', expanded: true}
14         ]
15     }
16 });
17 
18 Ext.define('MyApp.Examples.TreeDemo', {
19     extend: 'Ext.panel.Panel',
20 
21     height: 465,
22     width: 653,
23     title: 'My Panel',
24 
25     initComponent: function() {
26         var me = this;
27 
28         Ext.applyIf(me, {
29             items: [
30                 {
31                     xtype: 'treepanel',
32                     height: 430,
33                     width: 200,
34                     autoScroll:true,
35                     animate:true,
36                     id: 'treeOrg',
37              
38                     //默认根目录显示
39                     rootVisible:true,
40                     border:false,
41                     animate:true,
42                     store: treestore,
43                     lines:true,
44                     enableDD:true,
45                     containerScroll:true,                  
46 
47 
48                     listeners: {
49                            
50                             itemdbclick:{                            
51                                 fn: function(view, record, item, index, e,obj){
52                                     alert('dbclick');e.stopEvent;
53                                 },
54                                 scope: this
55                             }
56                             ,
57                              itemclick: {
58                                     fn: function(view, record, item, index, e,obj){
59                                             alert(record.data.id+':'+record.data.text);
60                                             e.stopEvent;
61                                         },
62                                     scope: this
63                             },
64                             checkchange: {
65                                 fn: function(node,checked,obj) {
66                                     alert('checkchange');
67                                     
68                                     
69                                 }
70                             }
71                         }
72 
73                 }
74             ]
75         });
76 
77         me.callParent(arguments);
78     }
79 
80 });

 

 1

 

 

转载于:https://www.cnblogs.com/baishahe/archive/2012/05/18/2507341.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值