Reputation: 1032
I'm building a website that use ExtJS, once I click a button
it calls Ajax to load a html page, and add it to tabpanel as an item.
mainTab.add({
xtype: 'panel',
html: ajaxResponse.responseText
})
But the javascript in that html page does not execute ,
how to solve this problem? Thanks very much!
EDIT It seems I have found it out, any better solution is welcome:
mainTab.add({
html:'<iframe src="'+UrlText+'" frameborder="0" scrolling="auto"></iframe>'
})
Upvotes: 0
Views: 4025
Reputation: 3413
myCompLoaderPanel = Ext.create("Ext.panel.Panel",{
width:200,
height:300,
title:"From ComponentLoader",
loader:{
autoLoad:true,
scripts:true,
url:"a.html"
}
});
mainTab.add(myCompLoaderPanel);
for me, this is the easier way..
cause i do not need to handle manually the ajax call. just put it in url config.
and this is how to load the loader : myCompLoaderPanel.getLoader().load()
this is usefull if you set autoLoad: false
for the loader.
Upvotes: 2
Reputation: 995
You can add iframe using http://docs.sencha.com/ext-js/4-1/#!/api/Ext.ux.IFrame
here is example
mainTab.add(Ext.create('Ext.ux.IFrame',{
src:'http://www.google.com',
title:'google'
}))
Upvotes: 2