-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I have a window X with a button that calls a modal window Y . Inside that second window I have another modal window.
When I click the button the first time all works ok. But the second time the modal window Y appears at the bottom of the window X and all the page appears disabled.
I have made an example code:
This is the window with the button:
<?page title="new page title" contentType="text/html;charset=UTF-8"?> <zk> <borderlayout width="1024px" height="1000px"> <center> <panel> <panelchildren> <button label="Abrir Ventana"> <attribute name="onClick"><![CDATA[ Window oWNuevaVentana = (Window) Executions.createComponents("NuevaVentana.zul", null,null); try { oWNuevaVentana.doModal(); } catch (Exception e) { } ]]></attribute> </button> </panelchildren> </panel> </center> </borderlayout> </zk>
And it calls this window:
NuevaVentana.zul
<?page title="new page title" contentType="text/html;charset=UTF-8"?> <zk> <window id="VentanaIncidencia" title="Nueva Ventana" border="normal" mode="modal" defaultActionOnShow="moveDiagonal" closable="true" position="center" onClose="VentanaObservacionesTarea.detach()"> <button label="Ventana Observaciones" onClick="VentanaObservacionesTarea.doModal()"/> </window> <window id="VentanaObservacionesTarea" visible="false" title="_Observaciones de la tarea" width="400px" height="200px" closable="false" defaultActionOnShow="moveDiagonal" position="center"> Hola </window> </zk>
It only happens when the modal window have another modal window inside. I have try it with ZK3.6.3, ZK5.0.0, ZK5.0.4 and it works OK. Now I'm using the evaluation version of ZK EE 5.0.4. It only fails with this version.
The defaultActionOnShow=moveDiagonal" neither works.
You may look at the javadoc of setDefaultActionOnShow.
It's deprecated.
void org.zkoss.zul.Window.setDefaultActionOnShow(String onshow)
Deprecated. As release of 5.0.0, replaced with JavaScript overriding. Sets the action of window component to show the animating effect by default.
Default: null. In other words, if the property is null, it will refer to the configuration of zk.xml to find the preference with "org.zkoss.zul.Window.defaultActionOnShow", if any. For example,
<preference>
<name>org.zkoss.zul.Window.defaultActionOnShow</name>
<value>slideDown</value>
</preference>
Parameters:
onshow the action to take when showing up a window
Since:
3.0.2
ok, thank you.
And have you try the other thing that is happening only with the evaluation version?
I have a window X with a button that calls a modal window Y . Inside that second window I have another modal window.
When I click the button the first time all works ok. But the second time, after closing the modal window with the navigator closing button, the modal window Y appears at the bottom of the window X and all the page appears disabled.
Yes, I know it is detached. But the second time you push the button to create it, it is not created well. It appears like disabled at the bottom of the window.
It only happens if the modal window you are calling with the button have another modal window in it. And only with the evaluation version of ZK 5.0.4 EE. I will like to attatch a photo but I don't know how...
The most simple code I could create (it's not very different from the provided above):
The main window with the button:
<?page title="new page title" contentType="text/html;charset=UTF-8"?> <zk> <window> <button label="Abrir Ventana"> <attribute name="onClick"><![CDATA[ Window oWNuevaVentana = (Window) Executions.createComponents("NuevaVentana.zul", null,null); try { oWNuevaVentana.doModal(); } catch (Exception e) { } ]]></attribute> </button> </window> </zk>
The modal window with another modal window in it:
<?page title="new page title" contentType="text/html;charset=UTF-8"?> <zk> <window id="VentanaIncidencia" title="Nueva Ventana" border="normal" mode="modal" defaultActionOnShow="moveDiagonal" closable="true" position="center" onClose="VentanaObservacionesTarea.detach()"> <button label="Ventana Observaciones" onClick="VentanaObservacionesTarea.doModal()"/> </window> <window id="VentanaObservacionesTarea" visible="false" title="_Observaciones de la tarea" width="400px" height="200px" closable="false" defaultActionOnShow="moveDiagonal" position="center"> Hola </window> </zk>
Instead:
Window oWNuevaVentana = (Window) Executions.createComponents("NuevaVentana.zul", null,null); try { oWNuevaVentana.doModal(); } catch (Exception e) { }
write:
try { Window oWNuevaVentana = (Window) Executions.createComponents("NuevaVentana.zul", null,null); oWNuevaVentana.doModal(); } catch (Exception e) { }
2. NuevaVentana.zul ???????
Which of the two window components inside should be showed modal?????
3. Separate the windows in single classes and you would have not this problems .
best
Stephan
Asked: 2010-10-25 03:24:55 +0800
Seen: 1,049 times
Last updated: Nov 04 '10