I'm using the ASP.NET wrapper for JqGrid. I'd like to programmatically wire up handlers for some of the grid's events (e.g. gridComplete
, resizeStop
).
All the examples I've seen have you wire up the event as part of the options when creating the grid object - for example:
$("#gridid").jqGrid({
...
onSelectRow: function(){ ... },
...
});
However, the ASP.NET component does this initial setup for me. I can customize some client-side handlers on the component, like gridInitialized
; but (bizarrely) only a small subset of the events are exposed this way.
So: Once the grid has initialized, is there a way to attach handlers to its events? I've tri开发者_开发技巧ed things like
$grid.setGridParam("resizeStop", function () { alert("!!") }); // DOESN'T WORK
and
$grid.resizeStop = function () { alert("!!") }; // DOESN'T WORK
and of course the standard jQuery event binding syntax
$grid.bind("resizeStop", function () { alert("!!") }) // DOESN'T WORK
but none of this works.
Any ideas?
You can do change event handler with respect of setGridParam
method (see a close question Add an event handler to jqGrid after instantiation). It must work on the same way for commertial and for the open source version of jqGrid. Just try following:
$('#gridid').jqGrid('setGridParam', { resizeStop: function(newwidth, index) {
alert("The column with the index " + index + " has now the width " + newwidth);
} } );
精彩评论