PDA

View Full Version : reload an iframe in an Ext Component



billsalvucci
23 Oct 2012, 11:03 AM
I have the following component


{
xtype: 'component',
autoEl: {
tag: 'iframe',
style: 'height: 100%; width: 100%; border: none',
src: 'resources/pdf/quote.pdf'
},
height: 600,
id: 'pdf',
width: 600
}


I can reload the iframe using

document.getElementById('pdf').contentDocument.location.reload(true);

Is there a way to do this same thing, but using Ext? I know that I can get the Ext.dom.Element that wraps the iframe, but I don't know what to do with it.

Barzoy
24 Oct 2012, 4:52 AM
Did you tried Ext.ux.IFrame (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.ux.IFrame-method-load)? It has no reload() method but has load(url) method so you can use it as load(url + '?' + Math.random()). Also check its source code (http://docs.sencha.com/ext-js/4-1/source/IFrame.html#Ext-ux-IFrame-method-load), it contains a basic iframe workaround which is could help you to complete your task task by the Ext-way.