1
votes

Extjs

I have an ifram inside a Ext.Panel and the panel is inside an Ext.Window

how can i make the window auto height when the content of the iframe change

please see the code:

var filePanel = new Ext.Panel({
     autoHeight: true
});

var fileUploadWindow = new Ext.Window({
    modal: true,
    autoHeight: true,
    title: 'File Upload',
    closable: true,
    draggable: true,
    autoDestroy: false,
    width: 570,
    items: [filePanel],
    shadow: true,
    buttons: [{
        xtype: 'button',
        text: 'Close',
        handler: function (button) {
            fileUploadWindow.hide();
            fileStore.reload();
        }
    }]
});

filePanel.add(new Ext.Panel({
    html: '<iframe src="../shared/Upload.aspx?_key=' + sskey + 
        '&_id=' + wkId + '" style="width:550px; border:none;"></iframe>'
}));

can someone help me ??

2

2 Answers

0
votes

IMO the best way is to resize window after document in frame is loaded. Actually I don't see any other way. You need to get frame element, then attach handler to load event to resize window. You can get iframe document by calling var innerDoc = (frame.dom.contentDocument) ? frame.dom.contentDocument : frame.dom.contentWindow.document; and then access document height by innerDoc.body.scrollHeight.

Working sample: http://jsfiddle.net/unS7y/3/

0
votes

Lolo is right. You need to resize the window after retrieving the height from the iframe.