2

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 tried 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?

Herb Caudill
  • 50,043
  • 39
  • 124
  • 173
  • 1
    As a side comment, the incompleteness of the ASP.NET wrapper is really, really maddening. There's so much that you can do using the plain open-source component that's just completely inaccessible if you use the wrapper. – Herb Caudill Jul 29 '10 at 01:56
  • I agree. I would not have opted to buy the wrapper from Trirand if I knew how utterly incomplete, and at times useless, the wrapper really is. Did you happen to get this working? – Cody Oct 23 '14 at 02:52

1 Answers1

2

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);
} } );
Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • This doesn't seem to work. Not sure if whoever up-voted this answer actually got it to work, but nothing happens on my end. – Cody Oct 23 '14 at 02:43
  • @Cody: The answer is very old, but all still work. Look at [the demo](http://www.ok-soft-gmbh.com/jqGrid/setResizeStop.htm) and resize a column. You will see the alert which was set be the above code. – Oleg Oct 23 '14 at 05:03
  • Thanks. This method does work, in my case I had the parameters in the method incorrect. – Cody Oct 23 '14 at 15:24