Results 1 to 3 of 3

Thread: How to Save and Retrieve Grid format in Database

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

    Default 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
    167
    Vote Rating
    10
      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
    6,154
    Answers
    501
    Vote Rating
    247
      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

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
  •