violinista
20 Sep 2007, 6:39 AM
Hello, I noticed a strange issue working with two dialogs: One is showed on main button click, and another is showed when button "Proceed>>" is clicked on first dialog, while first dialog is closed. Here is the working code:
var dialog1,dialog2;
var showDialog1=function(){
if(!dialog1){
dialog1 = new Ext.BasicDialog(null, {
autoCreate: true,
width:400,
height:200,
modal: true,
closable:true,
collapsible:false,
title:'dialog 1'
});
dialog1.addButton({
text:"Proceed>>",
handler:function(){
dialog1.hide();
showDialog2();
}
});
dialog1.addButton({
text:'Cancel',
handler:dialog1.hide
});
}
dialog1.show();
};
var showDialog2=function(){
if(!dialog2){
dialog2 = new Ext.BasicDialog(null, {
autoCreate: true,
width:300,
height:200,
modal: true,
closable:true,
collapsible:false,
title:'dialog 2'
});
dialog2.addButton({
text:'Cancel',
handler:dialog2.hide
});
}
dialog2.show();
};
new Ext.Button(
Ext.DomHelper.append(document.body,{tag:'div'},true),
{
text:'try dialogs',
handler:showDialog1
}
);
So, the scenario is:
-I click on "try dialogs" button, the first modal dialog is shown
-then I click on "Proceed>>" button on first modal, its closed, and showed second dialog.
-When I click on "Cancel" button on second dialog, it is hidden normally,
- and, when I try to click again on "try dialogs" button, the second dialog is showed - not the first!
Do you know what could be the problem?? It makes me mad.
P.S. at the end, when I click on "Cancel" button of wrong displayed second dialog, it closes, but modal DIV remains on the screen, without the chance to do anything on the page. Pretty strange!
var dialog1,dialog2;
var showDialog1=function(){
if(!dialog1){
dialog1 = new Ext.BasicDialog(null, {
autoCreate: true,
width:400,
height:200,
modal: true,
closable:true,
collapsible:false,
title:'dialog 1'
});
dialog1.addButton({
text:"Proceed>>",
handler:function(){
dialog1.hide();
showDialog2();
}
});
dialog1.addButton({
text:'Cancel',
handler:dialog1.hide
});
}
dialog1.show();
};
var showDialog2=function(){
if(!dialog2){
dialog2 = new Ext.BasicDialog(null, {
autoCreate: true,
width:300,
height:200,
modal: true,
closable:true,
collapsible:false,
title:'dialog 2'
});
dialog2.addButton({
text:'Cancel',
handler:dialog2.hide
});
}
dialog2.show();
};
new Ext.Button(
Ext.DomHelper.append(document.body,{tag:'div'},true),
{
text:'try dialogs',
handler:showDialog1
}
);
So, the scenario is:
-I click on "try dialogs" button, the first modal dialog is shown
-then I click on "Proceed>>" button on first modal, its closed, and showed second dialog.
-When I click on "Cancel" button on second dialog, it is hidden normally,
- and, when I try to click again on "try dialogs" button, the second dialog is showed - not the first!
Do you know what could be the problem?? It makes me mad.
P.S. at the end, when I click on "Cancel" button of wrong displayed second dialog, it closes, but modal DIV remains on the screen, without the chance to do anything on the page. Pretty strange!