-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4908145
By: prafal
Hi
I've got a problem with modal windows. When I click several times on "Click me" sometimes my modal window is created twice. As a result I get a org.zkoss.zk.ui.UiException: Not unique in the ID space ...
Is it a bug ? How can I solve this problem?
List:
<zk xmlns:zul="http://www.zkoss.org/2005/zul" >
<zul:listbox id="list" mold="default" multiple="true" width="300px">
<zul:listhead>
<zul:listheader label="Item 1" />
<zul:listheader label="Item 2" />
</zul:listhead>
<zul:listitem>
<zul:listcell label="Click me" style="color:#024CE3;">
<zul:attribute name="onClick">
Window win=Executions.getCurrent().createComponents("win.zul", null, null);
win.doModal();
</zul:attribute>
</zul:listcell>
<zul:listcell label="Value 2"/>
</zul:listitem>
</zul:listbox>
</zk>
Modal window:
<zk xmlns:zul="http://www.zkoss.org/2005/zul">
<zscript>
<![CDATA[
for(int i=0; i < 100000; i++) {
//... to make the window create longer
}
]]>
</zscript>
<zul:window width="670px" id="win" xmlns="http://www.w3.org/1999/xhtml"
border="normal" closable="true" title="Simple Window">
<zul:button label="Close">
<zul:attribute name="onClick">
win.detach();
</zul:attribute>
</zul:button>
</zul:window>
</zk>
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4908519
By: nalin1279
try this as property of your window component :
onClose="self.visible = false; event.stopPropagation();self.detach();"
something like this :
<zul:window width="670px" id="win" xmlns="http://www.w3.org/1999/xhtml"
border="normal" closable="true"
onClose="self.visible = false; event.stopPropagation();self.detach();"
title="Simple Window">
--
mickael
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4910331
By: prafal
It didn't help. Problem is in creating a window. When server is slow, two or more windows are created - each window has the same id="win". While the second window is creating exception is thrown telling me that i cannot have the same id.
There should be a way to prevent client sending the same request to server.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4910559
By: nalin1279
Hi rafal
as far as i know, the only solution i found (but i'm not an expert), to prevent multi action click is to use the
clients.showBusy("my text", true).
this method mask the main window until a clients.showBusy(null, false) is called.
basicaly :
before open your popup :
clients.showBusy("my text", true).
Window win = (Window) Executions.createComponents("my window", null, params); win.doModal();
and then in your popup, send a onlater event on your main window to desactivate the mask.
something like this :
<zul:window width="670px" id="win" xmlns="http://www.w3.org/1999/xhtml"
border="normal" closable="true" title="Simple Window"
onCreate="onPopupCreate()">
void onPopupCreate(){
window myMainWindow
= self.getDesktop().getPage("myMainPage").getFellow("myMainWindow");
Events.echoEvent("onLater", myMainWindow , null); }
dont forget in your main window to set the onLater property :
<zk xmlns:zul="http://www.zkoss.org/2005/zul" > <window id="myMainWindow" onLater="clients.showBusy(null, false)"> <zul:listbox id="list" mold="default" multiple="true" width="300px"> <zul:listhead> <zul:listheader label="Item 1" /> <zul:listheader label="Item 2" /> </zul:listhead> <zul:listitem> <zul:listcell label="Click me" style="color:#024CE3;"> <zul:attribute name="onClick"> Window win=Executions.getCurrent().createComponents("win.zul", null, null); win.doModal(); </zul:attribute> </zul:listcell> <zul:listcell label="Value 2"/> </zul:listitem> </zul:listbox> </window> </zk>
take a loock at this link :
http://www.zkoss.org/smalltalks/zk3.0.2/
i hope i help you, and if not , ask a better expert ^^
--
mickael
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4912155
By: henrichen
May I ask which ZK version you are using? This seems an old bug and fixed (send onClick twice).
/henri
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4912773
By: prafal
I'm currently using zk 3.0.1. I will try to upgrade zk version, and see what's happening.
DO NOT CROSSPOST! Putting all of this into a nearly 3 year old thread is not advisable. Nor is putting it into another thread after you've started a new one.
@Caclark
so sorry Caclark for posting my question to the wrong place... But actually I am not getting my problem solved so I just found this Help in forum so Just asked this question...
From next time I will remember these.
Best Regards
Yogendra
Asked: 2008-04-16 09:58:27 +0800
Seen: 1,091 times
Last updated: Feb 25 '11