PDA

View Full Version : Sharing stores between browser windows?



Shyru
24 Feb 2009, 12:31 AM
I'm Building an enterprise Ext application, und for this, it is necessary, that the user can oben multiple windows of the application for different monitors. (Our customers are often running 4-6 head systems)
Since the application displays data from some stores in different ways, and the stores are updated every 10 seconds, i thought it would be great to share the stores between windows, so that the update every 10 seconds is only needed once.
New windows are opened from the main window via window.open() and the childwindows detect if they are a childwindow using window.opener. This works great in all Browsers.
For the Stores, I have my own simple StoreManager which retrieves stores. In a childwindow, I just define the global StoreManager as reference to the openers-window StoreManager like this:

diloc.StoreManager=window.opener.diloc.StoreManager;

This works great in all Browsers (Firefox/Safari/Chrome) except IE. I can acces the window through window.opener, and even reference functions from it, and call them. But somehow the store does not load. It could also be, that the store is loaded, but the load event is not properly propagated to the child window. Are there any restriction in IE when using window.opener? (Of course apart from the same-origin-policy) Is there anything I need to change to make this work? Has anybody done this succesfully in IE?
Btw: IE does not output any error message, it just does not work. :-(

Any help would be greatly appreciated!

evant
24 Feb 2009, 12:35 AM
IE can't pass objects around between windows. You could probably hack it by:

1) http://extjs.com/deploy/dev/docs/?class=Ext.util.JSON&member=encode it as a string.
2) Dump it to the DOM.
3) Pass the element id to your window.
4) Have the window grab the DOM element and use http://extjs.com/deploy/dev/docs/?class=Ext.util.JSON&member=decode to make it an object again.

Yuk!

evant
24 Feb 2009, 12:36 AM
Actually that won't work either, I was thinking of just an object literal.

Shyru
24 Feb 2009, 1:43 AM
Well then, the only possibility would be to create a mirroring-store, that uses the store defined in the other window, and loads its data from the store from the main window. Would that work? That way the data would be duplicated, but the load would only be needed once.