-
13 Feb 2008 7:05 AM #11
Example
Example
@jsakalos: I would like to know how your created javascript code at the start of the page looks exactly like when you write the settings for a grid. Can you give me an example-line of code for your line (i am interessted especially in the columns-part) :
Code:Ext.state.Manager.getProvider().initState([{"name":"client-mod-client-grid","value":"..."}
-
13 Feb 2008 10:12 AM #12
The logic is simple: There is a server side script that retrieves saved state from database and generates the whole output enclosed in <script></script> tags together with initial state json.
What "columns-part" do you mean, I don't see 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
-
13 Feb 2008 12:01 PM #13
Did you guys take a look at the hybrid provider in the examples/state folder? It uses server side state (for the the example its in the session, but could go into a DB ).
Unlike fetching/saving of state over HTTP, it uses cookies with state, which the server collects and removes. Using this hybrid approach, there are no extra requests or processing, no big cookies being stored (they are removed by the server), the state is stored on the server and is available immediately when the page loads.
-
13 Feb 2008 1:05 PM #14
Thanks for info Jack, I haven't seen it before.
Anyway, I'll keep HttpProvider in my application(s) because I've run several times into the problem when my Apache server complained about size of cookies when I was using CookieProvider. The only way how to run out of that problem was to delete cookies at client.
Therefore, I've completely dropped the idea of cookies holding state information and the example also uses cookies, with less risk of crossing a boundary of size though.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
-
13 Feb 2008 1:36 PM #15
Jack - that actually sounds more in line with how I'd like to handle things, going to have to look in to it. Thanks for the suggestion!
-
14 Feb 2008 12:43 AM #16
Yes, good to know. My custom Provider is actually working fine (thanks to jsakalos (and his example code)) and the data goes as hash into my database instead into a cookie. While transfering the encodeValued hash, this hash is loosing it's urlencoding. So i urlencode my hash from the database when i get it and write it into the initState-method (of my Provider) at the start of my page (as jsakalos does). I decodeValue this hash in my Provider and receive a state object which i set as my state then. The grid gets rendered with the settings from the database afterwards.
Last edited by swagner; 14 Feb 2008 at 12:45 AM. Reason: misspelled something
-
21 Feb 2008 1:48 AM #17
Hi Jozef,
Thank you for your work.
I try HttpProvider to restore a window position and size, but it doesn't work.
I don't know where my error is.
Code:var prv = Ext.state.Manager.getProvider(); prv.on('readsuccess', function() { var w = Ext.getCmp('mywindow'); w.initState(); // w.render(); // w.doLayout(); w.show(); }); prv.readState(); ...
-
21 Feb 2008 2:22 AM #18
Do you initialize provider as described here http://extjs.com/forum/showthread.ph...791#post119791 ?
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
-
21 Feb 2008 5:55 AM #19
Yes I do.
I have seen that invoking more times the method:
The new window position is appended on http request:Code:var prv = Ext.state.Manager.getProvider(); prv.submitState();
Should "mywindow" params appear only once?Code:[http params] cmd=saveState&data=%5B%7B%22 name%22%3A%22mywindow%22%2C%22value%22%3A%22o%253Awidth%253Dn%25253A700%255Eheight%253Dn%25253A302%255Ex%253Dn%25253A290%255Ey%253Dn%25253A175%22%7D%2C%7B%22 name%22%3A%22mywindow%22%2C%22value%22%3A%22o%253Awidth%253Dn%25253A356%255Eheight%253Dn%25253A302%255Ex%253Dn%25253A290%255Ey%253Dn%25253A175%22%7D%2C%7B%22 name%22%3A%22mywindow%22%2C%22value%22%3A%22o%253Awidth%253Dn%25253A356%255Eheight%253Dn%25253A302%255Ex%253Dn%25253A290%255Ey%253Dn%25253A175%22%7D%5D&id=1
-
21 Feb 2008 6:25 AM #20
Is this a possible solution?
Code:queueChange:function(name, value) { var changed = undefined === this.state[name] || this.state[name] !== value; var o = {}; if(changed) { o[this.paramNames.name] = name; o[this.paramNames.value] = this.encodeValue(value); var found = false; for (var ii=0; ii<this.queue.length-1; ii++) { if (this.queue[ii].name == o.name) { this.queue[ii] = o; found = true; } } if (!found) { this.queue.push(o); } this.dirty = true; } return changed; },


Reply With Quote


