PDA

View Full Version : How to prevent firing an event..



tangalla
24 Sep 2012, 5:45 AM
Hi,

My grid has check box selection model. on item click i have some logic to do. But when i select check box it firing select and item click event. How do i prevent item click event on check box selection.I am using ExtJS 4.1

Thanks

sword-it
24 Sep 2012, 6:19 AM
HI!

take a look on stopEvent for Ext.EventManager, check this:-
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.EventManager-method-stopEvent

tangalla
24 Sep 2012, 7:38 AM
I tried this but its not working

Ext.define('AppShell.lib.CheckboxModel', {
extend: 'Ext.selection.CheckboxModel',
checkOnly: true ,
updateHeaderState: function() {

});
},
listeners : {
select: function(sm ,index ,eOpts){
Ext.getCmp('a').suspendEvents(false);
console.log('select');
Ext.getCmp('a').resumeEvents();

},
deselect: function ( sm ,index ,eOpts) {
Ext.getCmp('a').suspendEvents(false);
console.log('deselect');
Ext.getCmp('a').resumeEvents();
}
}
});
and also tried this

listeners : {
select: function(sm ,index ,eOpts){
Ext.EventManager.stopEvent('itemclick')
},
deselect: function ( sm ,index ,eOpts) {
Ext.EventManager.stopEvent('itemclick')
}

if i debug and hold some time its working without debug its not working. Thanks for your reply