-
1 Apr 2008 7:22 PM #41
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.
-
2 Apr 2008 12:14 AM #42
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...
-
2 Apr 2008 3:27 AM #43
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,
SakiJozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
3 Apr 2008 7:30 PM #44
Hi jsakalos,
Can you explain how how a state provider works? It seems to do nothing.
-
3 Apr 2008 7:38 PM #45
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
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
3 Apr 2008 7:59 PM #46
The manual talks about restoreState:
But I can't find "restoreState" in the manual/API reference other than in that one spot.// 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();
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.
-
4 Apr 2008 3:28 AM #47
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
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
4 Apr 2008 5:22 AM #48
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...
-
4 Apr 2008 6:07 AM #49
I think that this has already been solved in an another thread; correct me if I'm wrong...
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
11 Apr 2008 5:55 AM #50
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
i see nothingPHP Code:echo json_decode($_POST["data"]);
with
i seePHP Code:echo $_POST["data"];
[{\"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?


Reply With Quote