-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I am facing problem with nested popup windows. When I do an escape on child, onCancel of parent is called, hence both windows get closed.
I just want to close child first and on 2nd escape parent should be closed.
this is how i am creating popup windows.
Window popupWin = (Window) Executions.getCurrent().createComponents("edit_product_options_group_popup.zul", self, arg);
popupWin.doModal();
Any idea??
Hi ajaidka,
can you provide a reproducing sample?
index.zul
<?page title="Auto Generated index.zul"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<window title="Hello World!!" border="normal" width="200px" apply="com.test.popup.MainCtrl">
<button id="openPopup" label="Open Popup"></button>
</window>
MainCtrl.java
public class MainCtrl extends GenericForwardComposer {
private Button openPopup;
public void setOpenPopup(Button openPopup) {
this.openPopup = openPopup;
openPopup.addEventListener("onClick", new EventListener() {
@Override
public void onEvent(Event arg0) throws Exception {
Window popupWin = (Window) Executions.getCurrent().createComponents("/popup_win.zul", self, arg);
try {
popupWin.doModal();
} catch (SuspendNotAllowedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
}
}
popup_win.zul
<?page title="First Popup" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="Parent Popup" border="normal" apply="com.test.popup.PopupWinViewCtrl" onCancel="self.detach();">
New Content Here!
<button id="openChildPopup" label="Open Child Popup"></button>
</window>
</zk>
PopupWinViewCtrl .java
public class PopupWinViewCtrl extends GenericForwardComposer {
private Button openChildPopup;
public void setOpenChildPopup(Button openChildPopup) {
this.openChildPopup = openChildPopup;
openChildPopup.addEventListener("onClick", new EventListener() {
@Override
public void onEvent(Event arg0) throws Exception {
Window popupWin = (Window) Executions.getCurrent().createComponents("/child_popup_win.zul", self, arg);
try {
popupWin.doModal();
} catch (SuspendNotAllowedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
}
}
child_popup_win.zul
<?page title="First Popup" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="Parent Popup" border="normal" closable="true" onCancel="self.detach();">
Press Escape!
</window>
</zk>
escape on child_popup_win will close it's parent too.
I have tested the following sample with ZK 5.0.7.1
it works fine
<zk> <window title="Win 1" border="normal" width="200px" mode="modal" onCancel="System.out.println(1);self.detach();"> <window title="Win 2" border="normal" mode="modal" onCancel="System.out.println(2);self.detach();"> <textbox/> </window> <textbox/> </window> </zk>
Asked: 2011-09-02 23:27:18 +0800
Seen: 804 times
Last updated: Sep 14 '11
ZK studio and eclipse outline problem
ZK Package configuration problem
Eclipse Autocomplete not working in ZUL files...
Syntax Error mark ... help me!
Manual Installation of ZK Studio
Can't see button text whilst running simple demo
Adding Vbox to Center layout in Java