1. #1
    Sencha User
    Join Date
    May 2011
    Location
    Netherlands
    Posts
    44
    Vote Rating
    1
    rcbeuker is on a distinguished road

      0  

    Default How-to store the Grid-State

    How-to store the Grid-State


    I want to store/restore the column width, sort-order and column visibility from a Grid. After some searching around i found some answers which describe StateManager and applyState. For example a thread on 16 Oct 2012;

    "How to work with StateManager gxt 3"

    Within the 'best answer' Colin already switches from a 'standard' to a custom technique;

    And instead of this last step, consider just extending the AbstractStateHandler, and implementing your own applyState() method to modify the object that has this state. Build any handlers required then, to modify the contents of getObject() - notice that you can't replace the instance (in short: autobeans dont really work well like that), but you can modify any other object in it.
    Indeed this seems argumentative to me; i need an StateHandler which saves the Grid state to Google App Engine, and with a custom applyState() i could restore this state. But this seems a custom home made solution... Isn't there a standard procedure for this in the GXT3 framework? (like the approach with the loader/proxy from the Grid)

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Vote Rating
    88
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    The linked question is more about building wiring to ask questions about state for a new component, while your question seems more about how to persist any/all state in a custom way.

    When you write your own component that needs its own kind of state, start with the AbstractStateHandler to read and write state details from whatever abstraction the entire app is using.

    When you want to describe how the entire app should read and write all state details, implement a com.sencha.gxt.state.client.Provider instance. We don't have a 'standard procedure' for this that mandates a specific database, driver, servlet, but instead offer this abstract class to work from. Just like DataProxy, there are several subclasses to work from: com.sencha.gxt.state.client.AbstractRpcProvider is probably the most familiar if you already use RPC.

Thread Participants: 1

Tags for this Thread