PDA

View Full Version : grid with both headerdblclick and headerclick events.



jarlau
26 May 2010, 10:15 PM
Hi all,
I've tried to do something like this (http://www.extjs.com/forum/showthread.php?67531-Question-on-the-click-events) but Condor's solution doesn't work correctly on Ext 3.2.
when I double click the column header, 'headerdblclick' fires once, and 'headerclick' fires twice, so the g.skipNextClick already deleted in the first call. How can I fix this?

Thanks in advanced.

CrazyEnigma
27 May 2010, 12:22 PM
What kind of behavior are you expecting? That both headerclick functions are destroyed.

Header Single click: headerclick is fired, but the function is called 250 ms later. Click Code should execute.

Double click: headerclick fired, headerclick fired, headerdblclick fired. headerdblclick function called, sets flag to true, then headerclick function is called, return without doing any actions, second headerclick function is called, headerclick actions are performed.

Maybe you need to set another property of a different name, and then set it true. Do a check, and within it delete it.



grid.on({
headerclick: {
fn: function(g, h, e){
if(g.skipFirstClick){
delete g.skipFirstClick;
return;
}
else if (g.skipSecondClick) {
delete g.skipSecondClick;
return;
}
// do stuff
},
delay: 250
},
headerdblclick: function(g, h, e){
g.skipFirstClick = true;
g.skipSecondClick = true;
// do stuff
}
});

jarlau
27 May 2010, 9:57 PM
the trick can solve my problem. Thanks CrazyEnigma.

CrazyEnigma
31 May 2010, 12:07 PM
Hey no problems. You may want to edit the original post (Edit Post/Go Advanced) to put [SOLVED] in the header.