I'm using the column reordering feature in jqGrid
$grid = jQuery("#list").jqGrid({
sortable:true,
...
});
Is there an event that fires after columns are re-ordered? If there is, I can't see it!
Thanks in advance
I'm using the column reordering feature in jqGrid
$grid = jQuery("#list").jqGrid({
sortable:true,
...
});
Is there an event that fires after columns are re-ordered? If there is, I can't see it!
Thanks in advance
The comment given by @msanjay is the best way of doing this and here is the code which worked for me.
To restore the column order
The demo for the jqGrid sortable rows plugin says that all available options and events from sortable widget can be used.
If that's right then you should be fine just using the update event that's part of the sortable plugin.
Found after reading Mr W's reply and experimenting a bit, there's a better way of doing things:
Enjoy!
use this one
This works:
[EDITED]
$('.ui-jqgrid-hbox table', $('#' + gridId).parents('.ui-jqgrid-view')).bind("sortstop", function () { onGridColumnReordered(gridId) })
where you need to pass your gridId and create that onGridColumnReordered function of course.
There is a call in grid.jqueryui.js (jqGrid v3.8.2) in update() to ts.p.sortable.update() as discussed on the jqGrid message board, so:
However, please note that the array passed to your callback will be relative to the current column order. In other words, saving the array as is after moving multiple columns will not produce the desired results.
I had to do something like this: