-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
In my application on click of Save button (Parent window-Light Box) we are opening a small window (Child window) stating that Thanks for updating your Info. On click of 'Ok' button we need to close both the window (Parent & Child window).
Child window code for close the window:
<button id="idOk" label="OK" onClick='Executions.getCurrent().sendRedirect("");' />
Now on click of 'OK' button getting exception message - java.lang.InterruptedException: Destroy desktop [Desktop Desktop_2]
I have tried win.visible=false;event.stopPropagation();
but nothing works for me.
Please suggest what is the correct way to close both the window.
try win.onClose() or win.detach();
I have used win.detach() here:
<button id="idOk" label="OK" onClick='win.detach();' />
then it close only child window.
if i put
<button id="idOk" label="OK" onClick='win.detach();parentWin.detach();' />
it throwing some exception message.
I have to close both the window onClick of button.
No chance to solve this if we can not seen your code i.e. where are the main window and where are the child window.
If you will close the main window from a child window, so the childwindow must have access to it. You can do such things by overhanding the mainWindow controller self in a paramMap by using the Executions.createComponents() methode for creating a child window.
i can give you some code snippet here:
<zk> <window id="parentWin" apply="${Controller}" border="normal" mode="modal" width="530px" closable="true" onClose="cancelWin.doModal();event.stopPropagation();" height="800px"> <html:div class="es-scrollable" style="width: 522px;"> <html:form class="es-form my-form"> <grid id="grid_number" mold="table-less"> <rows mold="table-less"> <row id="ROW_number" mold="table-less"> <label value="Welcome" /> <button id="okButton" label="OK" forward="onClick=Form.onOk" zclass="es-btn-new" sclass="fr" /> </row> </rows> </grid> </html:div> <window id="childWin" width="400px" visible="false" title="Confirmation" closable="true" border="normal" onClose="self.visible = false; event.stopPropagation();"> <grid mold="form-table-less"> <rows> <row mold="table-less"> <html:p>Thanks.</html:p> <html:div class="bottom-buttons"> <button sclass="fr" id="regOK" label="OK" onClick='Executions.getCurrent().sendRedirect("");' /> </html:div> </row> </rows> </grid> </window> </window> </zk>
when user click on "Ok" button in controller I am calling "onOk" method:
that process some business logic and on success, execute following code:
Window saveModalWin = (Window) win.getFellowIfAny("childWin"); saveModalWin.doModal();
and from controller this child window opens properly. but as user click on "Ok" button it throws java.lang.InterruptedException: Destroy desktop [Desktop Desktop_2] exception message.
may be this code snippet gives you some insight.
Thanks.
No chance for me. Seems there is not a clean line how to call the controllers and what should be in the java code or zul.
Window saveModalWin = (Window) win.getFellowIfAny("childWin"); saveModalWin.doModal();
event.stopPropagation();
Think about why you need more than one <window> component (nameSpace) in a zul-file.
best
Stephan
My requirement is : I have registration page (light box window), user enters his all information and click on the save button. we are opening a model window with message "Is entered information are correct" if he clicks on "Yes" all the entered information get save in DB and both the window save Window and Registration window should get closed. if user click on "No", return back to the registration page.
Yes my window controller extending GenericForwardComposer.
In my Controller java file, I am validating all the entered values and after successful validation opening save Window with following code:
Window saveModalWin = (Window) win.getFellowIfAny("saveWin"); saveModalWin.doModal();
once save Window open user clicks on the "Ok" button and following code executes:
<button sclass="fr" id="regOK" label="OK" onClick='Executions.getCurrent().sendRedirect("");' />
once user clicks on this Ok button i am getting exception message on my console stating that desktop destroy.
I have tried with window.detach(), but it close save window correctly but for registration window it throwing some error message.
Window saveModalWin = (Window) win.getFellowIfAny("saveWin"); saveModalWin.doModal()
I have problem to understand you. Why you do not call a simple Messagebox for asking 'if the data are correct? and evaluating the pressed button ( OK or NO ) ? In both cases THIS Messagebox is closed and you can go further.
If you do creating your modal windows with Executions.createComponents( "myModalWindow.zul", parent, paramMap) you can overhanded the parentController in the paramMap. In the ChildModalWindow you can read them back and have FULL access to the parent window.
Have a look on this Picture. All the modal windows have access to the underlaying parent windows.
Asked: 2010-08-09 16:11:35 +0800
Seen: 999 times
Last updated: Aug 11 '10