0

doModal and Not unique in the ID space

asked 2008-04-16 09:58:27 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


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>

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2008-04-16 13:27:04 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


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


link publish delete flag offensive edit

answered 2008-04-17 08:30:14 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


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.

link publish delete flag offensive edit

answered 2008-04-17 10:32:22 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


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


link publish delete flag offensive edit

answered 2008-04-18 00:36:55 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


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

link publish delete flag offensive edit

answered 2008-04-18 09:25:52 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


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.

link publish delete flag offensive edit

answered 2011-02-25 07:01:07 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

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.

link publish delete flag offensive edit

answered 2011-02-25 09:56:06 +0800

yaryan997 gravatar image yaryan997
210 2

@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

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-04-16 09:58:27 +0800

Seen: 1,077 times

Last updated: Feb 25 '11

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