PDA

View Full Version : Using UIView grid in an iframe = bombing



bhaidaya
26 Jun 2007, 11:38 AM
Question:
If i try and load a grid in an iframe can i include that in the scope of the Ext.getDom() function?

The lowdown:
I'm loading EXT in my top window.
I'm using Domino/Extnd to open my Domino documents in an iframe ( due to server side proprietary form onSubmit tags)
I am embedding a grid in one of these documents in that iframe

When i render the grid it throws an error

uncaught exception: Error listening for "mousedown". Element "ext-gen181" doesn't exist.

'ext-gen181' is a div already generated in the container in the iframe, it begins to build listeners and bombs.

Here is where it bombs in ext-all-debug.js online 1520. Clearly Ext.getDom is not looking in my iframe (duh)

1517var listen = function(element, ename, opt, fn, scope){
1516 var o = (!opt || typeof opt == "boolean") ? {} : opt;
1517 fn = fn || o.fn; scope = scope || o.scope;
1518 var el = Ext.getDom(element);
1519 if(!el){
1520 throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';
1521 }
1522...

Here's what i've done so far:
I added a new config variable to uiview called 'targetIframe'

on line 1009 in extnd-all-debug.js

var dh = Ext.DomHelper;
//BDS Added new config object called targetIframe
if (this.targetIframe){
var oIframe = Ext.get(this.targetIframe)
var container = oIframe.dom.contentWindow.get(this.container)
}else{
var container = (this.container.getEl) ? this.container.getEl() : this.container;
}
//var container = (this.container.getEl) ? this.container.getEl() : this.container;


ie:

var myApp = function(){
var showBtn, dialog;

return {
init : function() {
var view1 = new Ext.nd.UIView({
viewName : 'simpleview',
container : 'view1',
targetIframe: 'center-iframe'
});
}// end init
};// end 'return'
}();


Ext.onReady(myApp.init, myApp, true);

as seen in the demo-multiple-views.html of the EXTnd alpha

any ideas anyone?

jratcliff
26 Jun 2007, 11:48 AM
Do you have this available on a public server where I can step thru the code?

bhaidaya
26 Jun 2007, 11:56 AM
Sending you the info now...
It's my private dev server... if anyone else needs access send me a pm

dominodeviant
31 Jul 2007, 6:27 AM
I have the same issue. Did you manage to sort your out? assistance appreciated

bhaidaya
31 Jul 2007, 9:17 AM
Yes and no.
Putting a grid in an iframe is easy if you just load the EXT framework in that iframe as well. However i didn't want to load EXT more then once on coming to the app.

If you don't care about loading EXT more than once (like in the domino directory example) than just make sure the form you are embedding the grid in has EXT loaded as well.

In the app i'm working on i render all grids in a content panel using AJAX Get rather than loading all my domino windows in an iframe. This got me past my hurdle of the moment.

so every time i use a grid the container object is in scope.

Another approach that i was prepared to try but never did was writing an overide for Ext.GetEl to also look in the iframe if there was one. but I was only every using one iframe and already wrote a litle script to register the iframe as an obect in the top window. This would'nt work so well in an application like the domino directory where thre is multiple content panels that each have iframes...

Hope this helps...

Damian
30 Aug 2007, 6:04 PM
Hi,

I am having the same problem with the events not being able to find the element because it is looking inside the parent window.

Can I ask how you registered the iframe as a top window when you only had one?

Regards,

Damian

bhaidaya
31 Aug 2007, 8:16 AM
Ext currently won't look in an iframe for the container element to build the grid in. Nor can you register an iframe as accessible by ext.

I load all my view grids and portlet grids using content panels (no iframes)

I have yet to require a grid in any form on my app but you can get around this by loading ext in the iframe as well.

jratcliff
2 Sep 2007, 7:15 PM
There's also a memory leak with the iframes when you load and close them via a BorderLayout (like what we do with DominoUI). Rich has a fix for this that eliminates almost all of the leaks and we'll post it in the next Alpha version.