zoukankan      html  css  js  c++  java
  • 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      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                      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

  • 相关阅读:
    【转】 Ubuntu安装jdk报错:-bash /usr/.../java:No such file or directroy
    sudo 出现unable to resolve host 解决方法
    C99 布尔
    面向对象?
    高斯消元
    白皮 Chapter 2
    白皮 Chapter 1
    开启暑假新生活( •̀ ω •́ )
    [vijos P1040] 高精度乘法
    [SCOI2007] 修车
  • 原文地址:https://www.cnblogs.com/baishahe/p/2507341.html
Copyright © 2011-2022 走看看