1. #1
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    40
    Answers
    2
    Vote Rating
    0
    vinothsencha is on a distinguished road

      0  

    Default Unanswered: How to Save and Retrieve Grid format in Database

    Unanswered: How to Save and Retrieve Grid format in Database


    I am having a grid panel.
    I need to save and retrieve the hidden state, width, order and sort state of the grid columns.
    I have set the grid's property stateId and stateful to true.


    I am able to set it by adding the following code in controller's init function
    Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));


    The above one is saving and retrieving data from browser Cookies.
    In the same way, how can i save and retrieve it from the database?


    Can you please someone tell me how to do this?

  2. #2
    Sencha Premium Member
    Join Date
    May 2011
    Posts
    79
    Vote Rating
    2
    pscanlon1 is on a distinguished road

      0  

    Default


    Look at http://localhost/extjs/ext-4.2.0.663...CookieProvider

    You really have 2 methods, get and set to be concerned with.

    set is called when the state changes, and you can see in the cookieProvider that they set a cookie for the state of the object. You could add an AJAX call within the set method to persist to DB, save to a localStorage store, and sync the localstorage store,save to memory store and sync that with DB. The get method you override should read from whereever you decide to save the information to. THe constructor should load the state from the database, which would be in the same spot as


    me.state = me.readCookies();

  3. #3
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,387
    Answers
    434
    Vote Rating
    201
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    You might also check out this ux to see how another community member addresses the state provider on the server side.

    http://www.sencha.com/forum/showthread.php?141207