0

Window onModal

asked 2008-10-28 07:57:08 +0800

aleksandr gravatar image aleksandr
6

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

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2008-10-28 09:09:43 +0800

hkn gravatar image hkn
246 3

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>

link publish delete flag offensive edit

answered 2008-10-28 09:57:10 +0800

aleksandr gravatar image aleksandr
6

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.

link publish delete flag offensive edit

answered 2008-11-01 07:12:37 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

The winModal is already existed. Why not implement a doPrepareComponents() method and call it before calling doModal()?

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-10-28 07:57:08 +0800

Seen: 426 times

Last updated: Nov 01 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More