jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Column reorder
Tagged: jquery grid, jqwidgets grid
This topic contains 9 replies, has 2 voices, and was last updated by gopinath_ui 10 years ago.
-
AuthorColumn reorder Posts
-
Hi,
On grid load, columns will be order in col1, col2, col3….
when i drag the col3 next to col1 and saved. Then i need to grid column order to be load col1, col3, col2 etc. is it possible any solutions?
Regards
Gopinath BSHi Gopinath,
The Solution is to use the jQuery Grid‘s State Maintenance functionality: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/saveloadstate.htm?arctic
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter
I cannot store the whole state grid data in db.
the column order is based as index value in column.
If i get & set the index value in column, the header column will arrange as per number?
thanks
Gopinath BSHi Gopinath BS,
This is the solution which we can suggest you. There is event raised when columns order change and there is method for setting the column’s index. If this is what you need, you can build your own custom solution for storing the order and applying it later when you need.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comMay I have Jsfiddle example!
Hi peter,
Can u give example for event raised when columns order change and there is method for setting the column’s index and storing the order and applying it later when we need.
Regards
Gopinath BSHi Gopinath BS,
You may look at the Grid’s API Documentation. Ex: http://jsfiddle.net/jqwidgets/PMxtZ/ and http://jsfiddle.net/jqwidgets/9ePBx/
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
setcolumnindex is work fine.
But in past I found the problem, when jqxgrid load with my columns order which is save in db, and then not reordered as per my column details in table view.
I have mentioned the coding which is problem and worked as below:
PROBLEM:
—————————-
$(“#grid”).jqxGrid(‘beginupdate’, true);
$(‘#grid’).jqxGrid(‘setcolumnindex’, cols[i].ColumnName, i + 1);
$(“#grid”).jqxGrid(‘showcolumn’, value.value);
$(“#grid”).jqxGrid(‘hidecolumn’, value.value);
$(“#grid”).jqxGrid(‘hidecolumn’, value.value);
—————————-WORKED:
—————————-
$(“#grid”).jqxGrid(‘beginupdate’, true);
$(“#grid”).jqxGrid(‘showcolumn’, value.value);
$(“#grid”).jqxGrid(‘hidecolumn’, value.value);
$(‘#grid’).jqxGrid(‘setcolumnindex’, cols[i].ColumnName, i + 1);
$(“#grid”).jqxGrid(‘hidecolumn’, value.value);
—————————-I have used worked order code execute and now i work fine.
Cheers
Gopinath BSHi Gopinath BS,
Good for you. However, don’t forget to call “endupdate” because it’s missing in your code and in general I don’t think that beginupdate is necessary for 1 setcolumnindex call. I also do not understand why you hide, show and then hide again the same column.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
I am used endupdate in my code, her missing.
Reason for show & hide column is, user ll select the column option, the selected column options only display in table view and other ll hide.
So only i am used.
Regards
Gopinath BS -
AuthorPosts
You must be logged in to reply to this topic.