jQuery UI Widgets Forums Grid Default column order jqxgrid

This topic contains 5 replies, has 2 voices, and was last updated by  Peter Stoev 10 years, 9 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Default column order jqxgrid #53969

    ramzendo
    Participant

    Hi,

    I’m trying to implement a functionality that resets the whole grid to its default stage but I’m having troubles with it.
    What I have done until now is something like this:

    $("#jqxgrid-<?php echo $_POST["selectScenario"] ?>").jqxGrid('clearselection');
    $("#jqxgrid-<?php echo $_POST["selectScenario"] ?>").jqxGrid('removesort');
    $("#jqxgrid-<?php echo $_POST["selectScenario"] ?>").jqxGrid('gotopage', 0);
    

    I have also set the following parameters:

    autosavestate: true,
    autoloadstate: true,
    

    But I need a button where everything is reset to default.
    Any help would be appreciated.
    Thanks!

    Default column order jqxgrid #53973

    Peter Stoev
    Keymaster

    Hi ramzendo,

    if you want the Grid to be in its default state when you refresh your page, remove autosavestate and autoloadstate. Otherwise, you can simply dynamically destroy, append a DIV tag for the Grid and initialize it again.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Default column order jqxgrid #53974

    ramzendo
    Participant

    Hi Peter,

    thanks for your quick response!
    Well, if I remove the autosavestate and autoloadstate parameters, then I will lose this feature where the grid remains with the latest stage.
    I have also tried to destroy de grid and load it again, but it didn’t work either. The grid loads with its last stage.

    According to you, how should I destroy the grid?
    My code was:

    $("#jqxgrid-<?php echo $_POST["selectScenario"] ?>").jqxGrid('destroy');

    Thanks again!

    Default column order jqxgrid #53975

    Peter Stoev
    Keymaster

    Hi ramzendo,

    To destroy the Grid, you should call the “destroy” method. Yes, the Grid will load its last state, because you’ve enabled autoloadstate. I think that should be expected when the property is set to “true”, because that’s what the property does.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Default column order jqxgrid #53977

    ramzendo
    Participant

    Hi Peter,

    I understand what autoloadstate and autosavestate do 😉
    Therefore I’m asking if there is something that let me build up the grid again from the beginning.

    Imagine this scenario:

    1.- user messes up with the column reorder.
    2.- user needs to have everything back to normal again.
    3.- user clicks on button to restore grid default settings.

    The user also needs to have the state saved because they need to leave the page and come back again.

    Thanks for your help!

    Default column order jqxgrid #53978

    Peter Stoev
    Keymaster

    Hi ramzendo,

    Well, for all these cases, you’d probably have to implement state management on your own through the savestate and loadstate methods.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.