Tree中检查更改中的itemclick事件

Tree中检查更改中的itemclick事件

本文介绍了如何在Ext Js Tree中检查更改中的itemclick事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ext.tree.Panel中添加了两个听众的检查更改和项目单击。但是我注意到,
当检查更改发生时,它也触发项目点击事件。我想阻止这个项目点击事件。

 监听器:{
checkchange:function(node,checked,eOpts) {
alert('this is check change');
},
itemclick:function(obj,record,item,index,e,eOpts){
alert('this is item click');
}
}

这是Ext树中的监听器。在检查更改,我希望得到这是检查更改此警报。如何可能?

解决方案

Lame解决方案!
我只能将脚本限制到itemclick。
在ExtJs 5.1.1中运行良好,可能在所有版本中,css checkbox类名为'x-tree-checkbox'

  listeners:{
itemclick:function(panel,record,item,index,event){
var clazz ='';
if(event.target.classList!= null){
clazz = event.target.classList [0];
}
如果(clazz!='x-tree-checkbox'){
...
}
}
}


I added two listeners 'check change' and 'item click' in Ext.tree.Panel. But i noticed that, when ever the check change occurs then it is also triggering item click event also. I wish to prevent this item click event.

    listeners : {
        checkchange: function(node, checked, eOpts){
            alert('this is check change');
        },
        itemclick : function(obj, record, item, index, e, eOpts){
            alert('this is item click');
        }
    }

This are the listeners in Ext tree. On check change i wish to get 'this is check change' this alert only. How it is possible ?

解决方案

Lame solution !I was able to limit the script only to the 'itemclick'.Works well in ExtJs 5.1.1 and probably in all versions where css checkbox class name is 'x-tree-checkbox'

listeners : {
    itemclick : function(panel, record , item , index, event){
        var clazz = '';
        if(event.target.classList != null){
            clazz = event.target.classList[0];
        }
        if(clazz != 'x-tree-checkbox'){
            ...
        }
    }
}

这篇关于如何在Ext Js Tree中检查更改中的itemclick事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 22:43