Reputation: 2066
I have a jqGrid in my page. I am giving an option to hide/show columns to the user(using columnchooser) and also he will be able to rearrange the columns using the same columnchooser option. Once the user has done the configuration he can export the grid as it is to excel.
I have managed to do everything. But only problem i am facing is the column order. My Grid's column model will have the same order as grid columns order or i have to find out the order?
If i have to find the order of columns, how can we do that?
Upvotes: 1
Views: 4503
Reputation: 221997
The key point of the solution of your problem are
remapColumns
parameter of jqGrid which hold the information about the last permutation of the columnsPlease don't confuse the remapColumns method with the internal remapColumns
parameter (the same name!!!) of jqGrid which represent array on the column indexes.
I recommend you to examine the code of the demo or this one and read the answer and another answers to the close problems referenced in the "UPDATED X" part of the answer. The demos shows how you can use remapColumns
method and parameter and how to use done
callback of columnChooser
to save and later restore the order of columns.
Upvotes: 1