ExtJS在面板中加载另一个应用程序
ExtJS load another app in panel
我正试图创建一个小型ExtJS应用程序(主应用程序),在面板中显示其他应用程序(辅助应用程序)。我可以加载应用程序的索引文件,但没有加载js脚本。辅助应用程序已生成。有人知道我应该如何正确加载辅助应用程序吗?谢谢
这是我的主要应用程序视图:
Ext.define('POCs.view.Main', {
extend: 'Ext.container.Container',
requires: [
'POCs.controller.MainController',
//'POCs.view.MainModel'
],
xtype: 'app-main',
controller: 'main',
viewModel: {
type: 'main'
},
layout: {
type: 'border'
},
items: [{
xtype: 'panel',
region: 'west',
items:[{
xtype: 'button',
width:200,
fontWeight: "bold",
itemId: 'err',
margin:20,
html: 'POC1',
bodyPadding: 10,
handler: 'onErrButton'
},
{ width:200,
xtype: 'button',
fontWeight: 'bold',
itemId: 'per',
margin:20,
html: 'POC2',
bodyPadding: 10,
//handler: 'onPerButton'
}
],
width: 250,
split: true,
},{
region: 'center',
xtype: 'panel',
id: 'canvas1',
name: 'Canvas1'
},
{
region: 'north',
xtype: 'panel',
split:true,
items:[{
region:'west',
xtype:'image',
src:'logo.jpg'
},
{
region:'center',
html: '<h2>Proofs of concept</h2>',
margin:"0 0 0 50",
}]
}]
});
这就是控制器:
Ext.define('POCs.controller.MainController', {
extend: 'Ext.app.ViewController',
requires: [
'Ext.MessageBox'
],
alias: 'controller.main',
config: {
refs: {
canvas1: '#canvas1',
}
},
init: function() {
var me=this;
me.control({
'#per': {
click: this.onPerButton,
}
});
},
onErrButton: function () {
Ext.Msg.confirm('Confirm', 'Are you sure?', 'onConfirm', this);
},
onPerButton: function () {
Ext.Ajax.request ({
url: 'ap3init/index.html',
scripts:true,
autoLoad:true,
success: function(response) {
var htmlText= response.responseText;
var cp1 = Ext.getCmp('canvas1').setHtml(htmlText);
//setHtml only sets the html but doesn't activate the scripts
}
});
},
onSecButton: function () {
Ext.Msg.confirm('Confirm', 'Are you sure?', 'onConfirm', this);
},
onSpcnButton: function () {
Ext.Msg.confirm('Confirm', 'Are you sure?', 'onConfirm', this);
},
onSpcoButton: function () {
Ext.Msg.confirm('Confirm', 'Are you sure?', 'onConfirm', this);
},
onConfirm: function (choice) {
if (choice === 'yes') {
//
}
}
});
正如Perdro Reis所建议的,解决方案是简单地使用iframe容器,只加载另一个应用程序的html文件。这不是最好的解决方案,因为我无法按预期加载js文件。
相关文章:
- HTML外部javascript加载另一个javascript
- 正在下载文件,同时加载另一个页面
- .replaceWith 无法使用 .click 函数加载另一个值
- 如何打开弹出窗口并重新加载另一个页面
- 收到事件时加载另一个.html页面
- jQuery-检查外部页面上是否存在DIV,如果存在,则加载DIV,否则加载另一个
- 在简单模式中,取消单击时不会调用onClose事件..当我在simple-modal上加载另一个jquery对话框时
- Android WebView:在javascript中,有没有一种方法可以加载另一个javascript文件,并为堆栈
- 我的按钮中的函数不会重新加载另一个函数
- 使用隐藏字段 ID 选择器加载另一个字段中的文本
- Javascript 来加载另一个 js 文件
- 加载另一个相同页面时,使用新数据激活第一个网页
- 无法从 OpenLayers 3 站点使用 WFS 示例作为基础加载另一个 WFS
- 滑动切换时加载另一个页面
- 限制元素,当我单击更多以加载另一个元素时
- 加载和定位图像,当加载另一个图像时
- 如何使用 JS 加载另一个 html 文件
- 单击CSS框加载另一个网页.CSS 或 js
- 加载另一个页面's的HTML,并使用jQuery通过选择器对其进行解析
- 加载另一个页面's DIV,与之互动?可能的(jQuery)