-
12 Aug 2007 8:53 PM #1
Ext.get() in Frames
Ext.get() in Frames
document.getElementById() works, but Ext.get() doesn't when I'm working in frames (my grid and other ext components are displayed within a page that is inside a frameset). Any ideas to overcome this...,
thanks,
rogr
-
12 Aug 2007 11:38 PM #2
Hi, check out the Using Layouts tutorial : http://extjs.com/learn/Tutorial:Usin...h_Ext_-_Part_1
there is a script that may help you, copied below:
best regards, SJPHP Code:function getIframeDocument(el) {
var oIframe = Ext.get('center-iframe').dom;
var oDoc = oIframe.contentWindow || oIframe.contentDocument;
if(oDoc.document) {
oDoc = oDoc.document;
}
return oDoc;
}
-
13 Aug 2007 1:27 AM #3
Not really safe. Ext isn't designed to handle multiple documents.
Ext.Elements are cached keyed by their id which is unique for the current document. If there is another element by the same id in another document this will cause a problem.
-
15 Aug 2007 11:54 PM #4
i use this function call to get to variables and methods in my iframe:
Ext.getDom('center-iframe').contentWindow.myvar
Ext.getDom('center-iframe').contentWindow.mymethod()
not sure if this is really useful to you, tho i suppose you could write a method in your iframe to change characteristics of dom elements and pass it the id of the elements you want to change, or there maybe a better way...
-
16 Aug 2007 7:59 PM #5
sj137,
Thanks for the info and I could use that approach in my code when I want to reference a variable. However the problem that I sometimes run into is ExtJS code internally uses Ext.get() and similar functions that do not take into consideration that it might be getting executed within a Frame. I am looking for a way by which I can direct the Ext package to look at only a particular frame, something like
This way any calls to Ext.get() will only reference variables in that particular frame. Just keep in mind that all my Ext code runs only in that frame.Code:// Ext's Root node points to the root for the frame. Ext.dom = top.contentframe.window; // contentframe is the id of the frame


Reply With Quote