VaZaA
VaZaA

Reputation: 398

invoking a doubleclick event

How do I trigger a "ondblClickRow" event in jqGrid? I need to invoke the double click event handler of the row on a click of a button.

button:
<a class="btn" id="shwDetails" type="button>Details</a>

grid:
$("#gridX").jqgrid({
...
...
ondblClickRow : function(rowID, iRow, iCol, e){
// event handler
fetchRowData(rowID);
}

...
...
});

The following doesn't seem to be working.

$('#gridX').trigger( 'jqGridDblClickRow' ); 
$('#gridX').trigger( 'ondblClickRow' );

Thanks in advance.

Upvotes: 3

Views: 2613

Answers (2)

Oleg
Oleg

Reputation: 222007

I your special case you can just call the function fetchRowData directly instead of "trigger a ondblClickRow event".

If some other code create jqGrid and you really need to "trigger" callback function ondblClickRow (not an event) you can do the following:

var ondblClickRowHandler = $("#gridX").jqGrid("getGridParam", "ondblClickRow");

ondblClickRowHandler.call($("#gridX")[0], rowID);

Upvotes: 2

orolo
orolo

Reputation: 3951

Does the ondblClickRow need one, some or all of those variables?

var rowID =  ,//your rowID
    iRow =  ,//your iRow 
    iCol =  ,//your iCol
    e; 
$('#gridX').trigger( 'jqGridDblClickRow', [rowID, iRow, iCol, e]);

docs here: http://api.jquery.com/trigger/

careful, though:

"The event object is always passed as the first parameter to an event handler, but if additional parameters are specified during a .trigger() call, these parameters will be passed along to the handler as well. To pass more than one parameter, use an array as shown here. As of jQuery 1.6.2, a single parameter can be passed without using an array."

Upvotes: 0

Related Questions