Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Richard White on Jan 03, 2008 13:55
open dhtmlx forum
onRowDblClicked

Hi,

we have an on row double click event on a treegrid - the tree is the only column

when a folder is opened and closed quickly it triggers the row double click event but of course we dont want it to trigger this event if they are opening and closing folders - only when they are double clicking on the item itself

is there a way around this

thanks

richard
Answer posted by Stanislav on Jan 04, 2008 14:35
The double event detection is done on native level ( it occurs only when browser itself generate doubleclick event ) so it pretty hard to resolve situation.
The most simple solution is to use some kind of flag to skip not necessary clicks , for example

grid.attachEvent("onOpen",function(){
    //occurs when item opened
    this._myflag=(new Date()).valueOf();
    return true;
});

grid.attachEvent("onRowDblClicked",function(){
    //occurs when row dbl clicked
    if (this._myflag && (this._myflag+500) > (new Date()).valueOf()) return true;

    ....any dbl click related code here....
});


described check will skip dblclick action if there is lesser than half of second between item opening and second click , that must effectively solve your problem.
Answer posted by richard white on Jan 04, 2008 05:44
hi

very clever solution!

thanks