PDA

View Full Version : [CLOSED-166] Overlay problems?



djMaxM
23 Jul 2010, 12:12 PM
I've got an overlay that I use for alert and prompt type functionality by hiding buttons. Bad things happen (the yes button appears to end up orphaned).



Ext.ns('home', 'Ext.ux');

var overlay = new Ext.Panel({
floating: true,
modal: true,
centered: true,
width: Ext.platform.isPhone ? 260 : 400,
height: Ext.platform.isPhone ? 250 : 400,
styleHtmlContent: true,
scroll: 'vertical',
html: 'This is a test',
dockedItems: [{
xtype: 'container',
dock: 'bottom',
cls: 'bBtn',
items: [{
id: 'okBtn',
xtype: 'button',
dock: 'bottom',
ui: 'action',
text: 'OK',
handler: function () {
overlay.hide();
}
}, {
id: 'okCancelBtns',
layout: 'hbox',
dock: 'bottom',
items: [
{ xtype: 'button', text: 'No', ui: 'drastic', flex: 1, id: 'cancelBtn', handler: function () { if (overlay.btnFn) { overlay.btnFn(false); } overlay.btnFn = null; } },
{ xtype: 'button', ui: 'action', text: 'Yes', flex: 1, id: 'okBtn', handler: function () { if (overlay.btnFn) { overlay.btnFn(true); } overlay.btnFn = null; } }
]
}]
}, {
dock: 'top',
xtype: 'toolbar',
title: '?',
id: 'overlayTB'
}],
cls: 'htmlcontent'
});

home.alert = function (txt, hdr) {
Ext.getCmp('okCancelBtns').hide();
Ext.getCmp('okBtn').show();
overlay.update(txt);
overlay.setCentered(true);
Ext.getCmp('overlayTB').setTitle(hdr || "Alert");
overlay.show();
};

Ext.setup({
tabletStartupScreen: 'resources/img/tablet_startup.png',
phoneStartupScreen: 'resources/img/phone_startup.png',
icon: 'resources/img/icon.png',
glossOnIcon: false,

onReady: function () {
home.alert("FOO", "BAR");
}
});

Jamie Avins
26 Jul 2010, 8:13 AM
Your issue has been entered in Trac for review. Thank you for the report.

evant
28 Jul 2010, 1:13 AM
This isn't a bug. You have a duplicate id ('okBtn').

djMaxM
28 Jul 2010, 3:12 AM
That did fix it, thanks a lot for the remote debugging. Strange failure mode, but clearly a mistake.

Sorry about that,
--Max