我得到這樣的問題:TabPanel下的Ext.MessageBox
TabPanel有兩個選項卡。首先是FormPanel,其次是GridPanel。
而且我在beforetabchange中添加了監聽器。當FormPanel中的值發生變化時,應該會出現Ext.MessageBox.cofirm,並提出問題:'您想保存更改嗎?'。
它出現在TabPanel下。
它不適用於任何類型的消息框。
這有點奇怪,因爲當我點擊這個表單中的提交按鈕時,有一個等待消息框,保存更改後有信息框。
任何想法?
編輯
我已經移除的TabPanel和FormPanel中所有配置集合這是第一個標籤,所以一切都是默認的。消息框看起來像(現在):
Ext.MessageBox.confirm('Title','message',Ext.emptyFn);
我認爲問題是,消息框被莫名其妙地GridPanel中這是一個tabpanel下綁定。 我已將插件添加到tabPanel,並在beforetabchange事件中顯示此確認消息。 有趣的是,我做了完全相同的代碼插件,它被添加到formPanel中提交按鈕,並且那裏的一切都很完美。
編輯的
new Ext.TabPanel({
activeTab: 0,
id: 'tabPanel_id',
items: [
new Ext.form.FormPanel({
cls: 'xf-windowForm',
bodyCssClass: '',
autoHeight: false,
autoScroll: true,
border: false,
layout: 'form',
buttonAlign: 'center',
monitorValid: true,
labelAlign: 'right',
labelPad: 10,
defaults: {
msgTarget: 'under',
anchor: '100%'
},
id: 'formPanel_id',
title: translate('tab_title-general'),
items: [
new Ext.form.TextField({
fieldLabel: 'label',
name: 'name',
id: 'id'
})
],
buttons: [
new Ext.Button({
text: 'save',
type: 'submit',
formBind: true,
plugins: {
init: function (component) {
component.on({
click: function() {
Ext.MessageBox.confirm('title', 'messsage', Ext.emptyFn);
}
});
}
}
})
]
}),
new Ext.Panel()
],
plugins: {
init: function(component) {
component.on({
beforetabchange: function() {
Ext.MessageBox.confirm('title', 'messsage', Ext.emptyFn);
}
});
}
}
});
還有的GridPanel這一個tabpanel下。 此按鈕插件中的消息框工作正常(選項卡面板變灰,消息框出現在頂部),但第二個在tabpanels插件中,在網格上添加另一個遮罩,並在面板下方和網格上方顯示。
編輯
Ext.onReady(function(){
new Ext.Window({
initHidden: false,
width: 700,
title: 'WindowTitle',
items: [
new Ext.TabPanel({
items: [
new Ext.Panel({title: 'Title1'}),
new Ext.Panel({title: 'Title2'})
],
plugins: {
init: function(component) {
component.on({
beforetabchange: function(t,c,n) {
Ext.MessageBox.confirm('MessageBoxTitle', 'Confirm message.', Ext.emptyFn, component);
}
});
}
}
})
]
});
});
這其中出現問題的完整代碼。 窗口顯示事件中的消息框顯示正常,但在tabPanel中顯示在窗口下。
我正在使用FF 4.0.1,但在IE 8和Chrome 12中也出現問題。 我使用的是Ext JS 3.3.1。
溶液
窗口的z索引必須降低(即至7000,缺省值爲9000)。 爲此,我使用了Ext.WindowGroup。
windows = new Ext.WindowGroup();
windows.zseed = 7000;
//and in config properties in window:
manager:windows
感謝大家的幫助。
它是否在所有瀏覽器中都存在? tabpanel和messagebox的'z-index'是什麼? – Kevin 2011-06-10 11:14:09
這發生在所有瀏覽器中。 TabPanel在9013上設置z-index,在9003上設置messagebox,即使我添加樣式類。 – 2011-06-10 13:57:54
你可以顯示你的tabpanel和messagebox的代碼嗎? – JamesHalsall 2011-06-10 14:17:28