1
我已經創建了一個iFrame窗口,並且有單獨的分機應用程序。如何訪問iFrame的主要
Win = new Ext.IframeWindow({
id: 'MyWinID',
modal: true,
resizable: true,
title: 'H1',
closable: true,
constrain : true,
});
Win.width = (winWidth/100) * 90,
Win.height = (winHeight/100) * 90,
Win.show().center();
在調整大小時,我想訪問放置在iFrame中的應用程序。
listeners :{
resize : function(a,b,c){
// How to access element of main at this point. I am trying this
var WinFrame = window.frames['MyWinID']
}
}
我主要的iFrame應用程序是
Ext.define('My.view.main.Main', {
extend: 'Ext.panel.Panel',
xtype: 'app-main',
requires: [
'Ext.plugin.Viewport',
'Ext.tab.Panel',
],
controller: 'main',
viewModel: 'main',
layout: 'border',
items: [{
xtype: 'toolbar',
frame: true,
region: 'south',
items: [ some item]
},
{
title: 'App',
itemId: 'selectionPanel',
region: 'west',
xtype: 'panel',
scroll: 'y',
frame: true,
items: []
},
{
xtype: 'panel',
region: 'center',
frame: true,
scrollable: true,
scroll: 'y',
itemId: 'abc',
reference: 'abc',
layout: {
//type: 'anchor',
type: 'vbox',
align: 'stretch'
},
items: []
}]
});
能否請你建議如何實現這一目標。
window.Ext.getCmp(「MyWinID」)這一部分,我明白,我在我的監聽使用,但是如何使用'Ext.getCmp(「MyTestContainer)',因爲你可以在我的主窗口中看到我需要訪問主窗口的一個項目。我能夠訪問窗口,但不能訪問窗口中的任何項目 – David
通過使用'window.frames ['MyID']'我得到一些html和div組件,並且在打開div之後,我將iframe作爲標籤獲得。如何訪問它 – David
@David您可以進入Sencha小提琴a nd測試。小提琴在iframe中運行。 'window.frames [0] .Ext'從瀏覽器控制檯爲您提供小提琴的'Ext'對象。不知道你在代碼中究竟做了什麼不同... – Alexander