0

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>'  
 })
4

2 回答 2

2

您可以使用http://docs.sencha.com/ext-js/4-1/#!/api/Ext.ux.IFrame添加 iframe

这是示例

mainTab.add(Ext.create('Ext.ux.IFrame',{
  src:'http://www.google.com',
  title:'google'
}))
于 2012-05-15T09:04:26.477 回答
2
myCompLoaderPanel = Ext.create("Ext.panel.Panel",{
    width:200,
    height:300,
    title:"From ComponentLoader",
    loader:{
        autoLoad:true,
        scripts:true,
        url:"a.html"
    }
});

mainTab.add(myCompLoaderPanel);

对我来说,这是更简单的方法..
因为我不需要手动处理 ajax 调用。只需将其放在 url 配置中。

这就是加载加载器的方法: myCompLoaderPanel.getLoader().load()
如果您autoLoad: false为加载器设置,这很有用。

于 2012-05-15T09:42:05.437 回答