Reputation: 593
I have a JQGrid which is loading data via AJAX and getting an JSON response.
I would like to know if there is a way to change the order of columns in the colModel of the grid without affecting the mapping of the cell data?
Thanks in advance, Thomas
Upvotes: 2
Views: 4180
Reputation: 24125
There is a method in jqGrid API called remapColumns:
$("#list").remapColumns([0,2,1,3,4],true,false);
There was an error in some older versions of jqGrid -> indexes in the permutation array were 1-based, not 0-based. You should also remember that all additional/hidden columns (rownumber, multiselect, etc.) are counted as well.
Upvotes: 4