mayur
mayur

Reputation: 47

prevent beforeSelectRow event, when a user doubleClick any Row in jqgrid

I am using cell editing in jqgrid and for that, i am using many different jqgrid events, as mentioned below ... 1) beforeSelectRow, 2)beforeEditCell, 3)afterEditCell, 4)onCellSelect, 5)ondblClickRow, etc...

Now, when i doubleClick on any of the row, the beforeselectRow code gets executed first.. which i want to prevent... but how to do that ??

Some example code is as below :-

ondblClickRow: function(id,irow,icol,e)
{
  ........
},
beforeSelectRow : function(rowid, e) 
{   

    if(rowid==lastSelected)
    {
        $sampleDialog.dialog('open');
    }
}

Upvotes: 1

Views: 2752

Answers (1)

Oleg
Oleg

Reputation: 221997

Different web browsers process the double-click event in a little different ways. So in general you can't prevent 'click' event before 'dblclick'. The callback beforeSelectRow will be called inside of click enevt handler defined inside of jqGrid code. In jQuery documentation of dblclick event handler you can read the following (see here):

It is inadvisable to bind handlers to both the click and dblclick events for the same element. The sequence of events triggered varies from browser to browser, with some receiving two click events before the dblclick and others only one. Double-click sensitivity (maximum time between clicks that is detected as a double click) can vary by operating system and browser, and is often user-configurable.

What you currently do is just not recommended way to binding both 'click' and 'dblclick' handles.

You don't describe the original problem which you has which is probably somewhere inside of ondblClickRow callback implementation. The only solution will be to examine reorganization of the program to have no collisions between the actions inside of beforeSelectRow and ondblClickRow callbacks.

Upvotes: 1

Related Questions