jQWidgets Forums

jQuery UI Widgets Forums Grid Column reorder

This topic contains 9 replies, has 2 voices, and was last updated by  gopinath_ui 10 years ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • Column reorder #71961

    gopinath_ui
    Participant

    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 BS

    Column reorder #71963

    Peter Stoev
    Keymaster

    Hi 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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Column reorder #71965

    gopinath_ui
    Participant

    Hi 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 BS

    Column reorder #71967

    Peter Stoev
    Keymaster

    Hi 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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Column reorder #71968

    gopinath_ui
    Participant

    May I have Jsfiddle example!

    Column reorder #71984

    gopinath_ui
    Participant

    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 BS

    Column reorder #71988

    Peter Stoev
    Keymaster

    Hi 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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Column reorder #72002

    gopinath_ui
    Participant

    Hi 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 BS

    Column reorder #72005

    Peter Stoev
    Keymaster

    Hi 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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Column reorder #72012

    gopinath_ui
    Participant

    Hi 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

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.