PDA

View Full Version : selecting element in other frame



rmauser
23 May 2007, 2:01 PM
Hello, I have two frames (leftFrame and mainFrame) and I'm trying to fadeout() on an element in the mainFrame when clicking a button in the leftFrame. This code works in IE but not in Firefox...anyone know what I need to change?

Ext.onReady(function() {

Ext.get("left1").on('click', function() {

Ext.get(parent.mainFrame.main).fadeOut();

});

});

jsakalos
23 May 2007, 3:27 PM
Just shot in the dark...

What says Firebug? Can it find this path: "parent.mainFrame.main"? Maybe you need to prepend window to form "window.parent.mainFrame.main". You could also try to run the code in the mainFrame, not in the leftFrame.

Firebug is your friend in this case... ;)

rmauser
23 May 2007, 6:20 PM
With parent.mainFrame.main and prepending window I get the same errors in Firebug:

Ext.get(window.parent.mainFrame.main) has no properties
(no name)()Untitled-1.html (line 13)
fire()ext-all-debug.js (line 1426)
fireDocReady()ext-all-debug.js (line 1456)
[Break on this error] Ext.get(window.parent.mainFrame.main).on('click', function(){


both still work in IE however..

rqmedes
23 May 2007, 11:09 PM
If you need a fix until someone else can provide a better solution you could try.

window.top.document.getElementById();

rmauser
23 May 2007, 11:51 PM
Not quite sure how to use that in this situation...can you elaborate? Thanks!

rqmedes
24 May 2007, 3:20 PM
well i am very much a beginner with ext, so there is probably a better solution.
I have a layout page with a couple of frames and i could not get a child frame to reference the parent frame using Ex.Get so i went back to the old javascript way


var infoEl = window.top.document.getElementById('info');

Eg i had an info div in my parent frame i wanted to add a custom template change to it to show info when a grid in the child window was clicked so i referenced the parent element via


grid.on('click', function(e) {
var infoEl = window.top.document.getElementById('info');
var data = grid.selModel.selections.items[0].data;
detailsTemplate.overwrite(infoEl, data);

});

rmauser
24 May 2007, 6:34 PM
Unfortunately still not working in Firefox...just IE