-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Some components (example button, anchor etc) have the autodisable attribute to prevent user from clicking the component multiple times and firing redundant requests.
Is there something similar available for listbox -> listitem or listcell?
I am displaying a modal window when a user clicks a row in the listbox (using the onClick attribute) If the user clicks it multiple time by mistake, I get the "Not unique in the new ID space" error.
I don't recommend this way. You just cover up the real problem. According to "Effective Java", we should not use try-catch block as a control structure like if-else.
I suggest applying a proper solution. Although it takes you a little more time, the proper solution is good for maintenance in a long term, and the solution might be useful in somewhere else of your system. Through finding and applying a solution, you will also learn more about ZK.
Thanks hawk for your answer.
For now I just added any empty "try catch" to handle the Exception "org.zkoss.zk.ui.UiException: Not unique in ID space ..."
this prevents zkoss from displaying the error message box.
Works fine for my use case.
There are several solutions:
If you allow creating multiple modal windows, you can just don't assign ID to the modal window.
If you do not want to create multiple modal windows, you can just toggle the visibility of the modal window when clicking a listitem instead of creating a new one. Then hide the window by clicking a button or closing it.
or you can use <popup>
component, and specify <listitem popup="myPopupId">
Asked: 2015-06-02 16:54:43 +0800
Seen: 23 times
Last updated: Jun 05 '15