-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Sometimes users click on a button more than once (either accidentally or they like double clicking), and I get the "Not Unique in ID space" error. Worse is that the window is partially embedded on the parent page, half created and a refresh is needed to get rid of it. This really kills the user experience in my app.
I use the window ID for data binding, so the ID is hard coded in the ZUL file. There are a lot of posts about dynamically generating the ID, but I don't know how that would work with data binding annotations. Please let me know if you do.
Or should I just use the event handler to manually keep track of any open windows and ignore subsequent clicks if a window is already opened?
Suggestions welcome. Thank you. ZK rocks!
Code fragments:
Most of my sub windows (overalapped) are created like this:
Window winEdit = (Window) Executions.createComponents(
"/plan/list_open.zul",
null,
params);
winEdit.doOverlapped();
In the ZUL file, the id is hardcoded, and I also use the id for databindings.
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="openList"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window title="View Patient List" id="openList" border="normal"
use="org.carepathfoundation.ui.plan.ListOpenViewController"
contentStyle="overflow:auto" height="600px">
<!-- Plan panel -->
<panel title="List Details" collapsible="true">
<!-- Toolbar -->
<toolbar id="listOpenToolBar">
<toolbarbutton id="listEditBtn" image="/img/edit.png" label="Edit Registry" />
<space />
<toolbarbutton id="planOpenBtn" image="/img/open.png" label="Open Plan" />
<space />
<toolbarbutton id="planEditBtn" image="/img/edit.png" label="Edit Plan" />
</toolbar>
<panelchildren>
<grid id="plan">
<columns>
<column width="200px"/>
<column />
</columns>
<rows>
<row>
Title
<label value="@{openList.list.title}" width="500px"/>
</row>
<row>
Description
<label value="@{openList.list.description}" width="500px"/>
</row>
<row>
Date Modified
<label value="@{openList.list.modifiedDate}" width="500px"/>
</row>
<row>
Rules
<listbox id="listRulesBox" model="@{openList.listRulesModel}">
<listitem self="@{each=rule}">
<listcell><label value="@{rule.title}"/></listcell>
</listitem>
</listbox>
</row>
....etc
Your issue arise, when you create the same window more than once. Hence, try to avoid creating a window multiple times.
You can create the window once and make use of setVisible method to hide or show it at later time. Otherwise close the opened window, before creating it again.
what happens if you change
<label value="@{openList.list.title}" width="500px"/>
to:
<label value="@{self.root.list.title}" width="500px"/>
I haven't tried it myself; perhaps that will cause a lookup of the window and invoke getList() on your use="..." class...can't remember off the top if the window or the page will be returned by ...self.root...
Asked: 2009-09-08 21:21:20 +0800
Seen: 409 times
Last updated: Sep 09 '09