Results 1 to 5 of 5

Thread: Grid State Restore using Cookies

  1. #1
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    50
    Answers
    2

    Default Answered: Grid State Restore using Cookies

    I am having multiple applications in my project.
    I need to save and restore the grid state for all the applications.


    Creating and displaying application:
    I am creating each window in the following way
    var frmOrderdetails = Ext.create('iMakeClient.view.SimpleOrder',{modal: false});
    frmOrderdetails.show();


    I am setting the following properties to a grid panel
    stateful: true
    stateId: OrderGridState


    Closing the application:
    Taking the particular application's window object and calling close() method.


    In the application controller's init action, i am having the following code
    Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));


    When i refresh my browser and open an application, it is restoring the last saved state.
    If i close and re-open the same application, it is not restoring the last saved state. It is displaying the default initial state of the grid.

    But i need to restore the last saved state while closing and opening the application also.


    Can someone please tell me why it is not working on application re-open?
    What needs to be changed to make it work?

    Thanks in advance.

  2. Thanks for the reply scottmartin.

    I got the problem.
    I had not set id for each column in the grid.
    I had set itemId for each column. That works only on first time.

    After i have set id for all the columns, it is restoring while application re-open also.

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    Are you sure you are not clearing things out when you close the browser?

    Does our basic grid example work?
    http://docs.sencha.com/extjs/4.2.1/e...ne/#array-grid

    It uses stateful grid.

  4. #3
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    50
    Answers
    2

    Default Grid State Restore using Cookies

    Thanks for the reply scottmartin.

    I got the problem.
    I had not set id for each column in the grid.
    I had set itemId for each column. That works only on first time.

    After i have set id for all the columns, it is restoring while application re-open also.

  5. #4
    Sencha User
    Join Date
    Apr 2013
    Posts
    58
    Answers
    2

    Default

    I have the same problem, with a rather large grid, and i found that vinothsencha is right, if i set id (not itemId) for each column, it works perfectly. My problem is that i'm rendering several grids of the same kind in my app simultaneously, so i can't assign id for each column...

    any ideas as to why this id fix thing is happening? workarounds?

    thanks

  6. #5
    Sencha Premium Member
    Join Date
    Nov 2007
    Location
    Sydney
    Posts
    117
    Answers
    3

    Default

    Landoni and vinothsencha, on the columns you should be setting stateId, not id.
    As per the documentation: http://docs.sencha.com/extjs/4.2.2/#...mn-cfg-stateId
    The stateId of a column only needs to be unique within the grid.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •