1. #41
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    Hey guys, as mentioned in my previous post on this thread, you really should take a look at the hybrid provider in the examples/state folder of the distribution.

    Saki, in response to your previous concern, only the state modification taking place is set in a cookie not the entire state (unlike CookieProvider). Because of that, there is no issue with the size of cookies getting too large.

    I really would like to encourage you to take a look as it is definitely a preferred way to tackle this issue and will result in a much better user experience (reduced HTTP requests), no data loss (if they leave the page immediately their state is still safe, unlike HTTP which aborts on leave) and less/simplified code. I've used the approach in many applications with great success.
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

  2. #42
    Ext User
    Join Date
    Mar 2008
    Posts
    41
    Vote Rating
    0
    jonx is on a distinguished road

      0  

    Default


    Hello Jack,
    I agree with you that in most cases the hybrid provider or even the cookie provider is a better choice (by the fact it's easier to setup and use) but just in my current project I can't use cookies at all. Meaning Saki's HttpProvider is the only way to go for me right now...

  3. #43
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,527
    Vote Rating
    379
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Hi Jack,

    I'll definitely take a look at it although it is not top priority for me right now. I've written this one before knowing about the Hybrid State provider and it works just fine for me and other. Anyway, there is always a space for improvement that I'll be only glad to fill...

    Cheers,
    Saki
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  4. #44
    Ext JS Premium Member stever's Avatar
    Join Date
    Mar 2007
    Posts
    1,406
    Vote Rating
    6
    stever will become famous soon enough stever will become famous soon enough

      0  

    Default


    Hi jsakalos,

    Can you explain how how a state provider works? It seems to do nothing.

  5. #45
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,527
    Vote Rating
    379
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Yeah, visually it does nothing but if you move a window new position is send to the server to be stored in a database. Next time you open the same window it opens in the last saved postition.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  6. #46
    Ext JS Premium Member stever's Avatar
    Join Date
    Mar 2007
    Posts
    1,406
    Vote Rating
    6
    stever will become famous soon enough stever will become famous soon enough

      0  

    Default


    The manual talks about restoreState:
    // in your initialization function
    init : function(){
    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
    ...
    // supposed you have a "Ext.BorderLayout" href="output/Ext.BorderLayout.html">Ext.BorderLayout
    var layout = new Ext.BorderLayout(...);
    layout.restoreState();
    // or a {Ext.BasicDialog}
    var dialog = new Ext.BasicDialog(...);
    dialog.restoreState();
    But I can't find "restoreState" in the manual/API reference other than in that one spot.

    At any rate, I think the example I'm working with is a bad one, which is why I don't see anything. I'm trying to get an accordian to remember which panel to show, but there is no event for setActiveItem. I think I need to have all the children save state instead.

  7. #47
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,527
    Vote Rating
    379
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    You could take a look at Ext.Component source code, this class deals with state most. You can also take a look at http://extjs.eu where I save collapsed state of panels. On simple function getState does it there.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  8. #48
    Ext User
    Join Date
    Mar 2008
    Posts
    41
    Vote Rating
    0
    jonx is on a distinguished road

      0  

    Default


    I also suggest you use firefox and the firebug module. that way you'll be able t see easily what is exchanged with the server... see the attachment...
    Attached Images

  9. #49
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,527
    Vote Rating
    379
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    I think that this has already been solved in an another thread; correct me if I'm wrong...
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  10. #50
    Sencha User
    Join Date
    Jan 2008
    Posts
    194
    Vote Rating
    0
    Richie1985 is on a distinguished road

      0  

    Default


    I want to use this script with a mysql backend. I become an error in the php saveState Function:

    Invalid argument supplied for foreach()

    because the data array is empty.

    when i make a test output in the php file like this
    PHP Code:
    echo json_decode($_POST["data"]); 
    i see nothing

    with
    PHP Code:
    echo $_POST["data"]; 
    i see

    [{\"name\":\"actiongrid\",\"value\":\"o:columns=a%3Ao%253Aid%253Ds%25253Acompany%255Ewidth%253Dn%25253A273%5Eo%253Aid%253Dn%25253A1%255Ewidth%253Dn%25253A146%5Eo%253Aid%253Dn%25253A2%255Ewidth%253Dn%25253A146%5Eo%253Aid%253Dn%25253A3%255Ewidth%253Dn%25253A67^sort=o%3Afield%3Ds%253Acompany%5Edirection%3Ds%253ADESC\"}]

    can you help me?