jQuery UI Widgets Forums Grid Resetting saved grid state

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Resetting saved grid state #26352

    timtate
    Member

    Hi, I have three issues:

    1) Is there a safe way to reset the grid state to the settings in the code?
    Like if a user has re-ordered columns and wants them put back to where they started, I’d like to be able to create a “reset” button.

    2) There is also a problem when we add new columns to the grid and someone with a saved state loads that new page, the order of columns is no longer correct.

    3) Does savestate work on IE7? If not, is there a recommended polyfill for localstorage?

    Resetting saved grid state #26366

    Dimitar
    Participant

    Hello timtate,

    1) Yes, there is a way to achieve this. In the rendered callback function of the grid, call the method getstate:

    rendered: function () {
    initialState = $("#jqxgrid").jqxGrid('getstate');
    }

    Then, when you wish to reset the state, call setstate with the initial state as parameter:

    $("#jqxgrid").jqxGrid('loadstate', initialState);

    2) Please, provide us with a code sample which illustrates the issue you experience.

    3) Yes, the method savestate is supported in Internet Explorer 7.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Resetting saved grid state #26438

    timtate
    Member

    Hi Dimitar,
    1) Does the rendered callback happen before autoload of any previous saved state happens? It seems like what you’re talking about would only reset to the previously saved state. I want to reset completely to what is defined in code.

    2) We’ve only run into this intermittently, I’ll see if I can write up an example to make it happen on purpose.

    Resetting saved grid state #26469

    Dimitar
    Participant

    Hi timtate,

    You are correct. The rendered callback function is also called when a saved state is loaded. A more proper solution is to do the same as suggested but in the ready callback function, which is called only once, when the grid is initialized.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.