1. #1
    Sencha User pablotcarreira's Avatar
    Join Date
    Feb 2012
    Location
    Brazil
    Posts
    12
    Vote Rating
    3
    pablotcarreira is on a distinguished road

      0  

    Default Where to set a "State Manager Provider" and make it works?

    Where to set a "State Manager Provider" and make it works?


    Hi,
    After a lot of trial I couldn't make the state manager work.

    In Application>launch I have:
    Code:
    var stateProvider=Ext.create('Ext.state.LocalStorageProvider');  //I've tried cookieProvider too.
    Ext.state.Manager.setProvider(stateProvider);
    Then in a Panel I have:
    Code:
    stateful:true,
    stateId:'abcPanelState',
    stateEvents:['resize'],
    width:200
    But nothing happens, the state is always lost.

    What am I missing?

  2. #2
    Sencha User pablotcarreira's Avatar
    Join Date
    Feb 2012
    Location
    Brazil
    Posts
    12
    Vote Rating
    3
    pablotcarreira is on a distinguished road

      2  

    Default


    SOLVED!

    I set the provider for the state manager in a controller's init function.
    Otherwise the saved settings were always overridden when the application started.

  3. #3
    Sencha Premium Member dnoizet's Avatar
    Join Date
    Aug 2012
    Posts
    78
    Vote Rating
    0
    dnoizet is an unknown quantity at this point

      0  

    Default


    I had the same issue, and the suggestion of pablotcarreira was the answer. Thanks :-)

  4. #4
    Sencha User
    Join Date
    May 2011
    Posts
    9
    Vote Rating
    0
    gmillerd is on a distinguished road

      0  

    Default


    So you add new controller (MyController), then select MyController, enable the init property and in the function code add your state info? That is what I am doing, and I see cookie data with the name of tabstate (doesn't change though), but it doesn't enforce anything when the page is loaded. Seems to still be missing something.

    PHP Code:

     init
    : function(application) {
            
    Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));
            
    console.log("controller.init");
      } 
    Then in your tool, perhaps a TabPanel

    PHP Code:

    xtype
    'tabpanel',
    statefultrue,
    stateId'tabstate',
    stateEvents: [ 'tabchange' ], 

Thread Participants: 2

Tags for this Thread