-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I have difficulties with window onModal event. I want to use window's onModal event to refresh states of textboxes (enabled/disabled) reliant of type of shown data. The problem is that onModal method is not called.
Here is my example code:
<?xml version="1.0" encoding="UTF-8"?>
<?page id="testZul" title="" cacheable="false"
language="xul/html" zscriptLanguage="Java" contentType="text/html;charset=UTF-8"?>
<zk xmlns="http://www.zkoss.org/2005/zul"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
<window title="Test window" width="100%" border="normal">
<button label="Press me">
<attribute name="onClick">
<![CDATA[
winModal.doModal();
]]>
</attribute>
</button>
</window>
<window id="winModal" title="Modal Window" width="300" border="normal" visible="false">
<attribute name="onModal">
<![CDATA[
labTest.setValue("onModal WAS CALLED");
]]>
</attribute>
<label id="labTest" value="(onModal was not called)" />
</window>
</zk>
Aleksandr
Hi,
afaik onModal is not a known event.
if you test the following modification you will find that the window is created while loading the page and not while clicking the button. Use Executions.createComponents() to create a new window from a second zul file.
Regards
<window id="winModal" title="Modal Window" width="300"
border="normal" visible="false" >
<attribute name="onCreate">
<![CDATA[
Messagebox.show("Mode=" + winModal.getMode());
if( "modal".equalsIgnoreCase(winModal.getMode()) ) {
labTest.setValue("onModal WAS CALLED");
} else {
labTest.setValue("(onModal was not called)");
}
]]>
</attribute>
<label id="labTest" />
</window>
Thank you very much for you reply.
I think that Executions.createComponents() is a good way for some more complex solution.
In my case I have one data bound window (BeanEditWindow) that is used to fill data when creating new beans and to modify data of existing beans. Some ideas are taken from http://www.pichelhofer.at/ZKDemo/ but in my case windows "use" classes are universal and are not dependent on beans. Instead, I try to implement some UI control management and data validation in ZUL file.
The problem is that I need to have a way to override some function in ZUL file (using an attribute for example, like in my not-working onModal case) that is called when window is shown using doModal.
Something like window.doPrepareComponents() from Java class and "<attribute name="onPrepareComponents"></attribute>" in ZUL file.
Asked: 2008-10-28 07:57:08 +0800
Seen: 426 times
Last updated: Nov 01 '08