0

autodisable for listitem

asked 2015-06-02 16:54:43 +0800

ssatguru gravatar image ssatguru
6 1

updated 2015-06-02 17:31:20 +0800

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.

delete flag offensive retag edit

3 Answers

Sort by ยป oldest newest most voted
1

answered 2015-06-05 02:32:51 +0800

hawk gravatar image hawk
3250 1 5
http://hawkphoenix.blogsp... ZK Team

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.

link publish delete flag offensive edit
0

answered 2015-06-03 18:43:30 +0800

ssatguru gravatar image ssatguru
6 1

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.

link publish delete flag offensive edit
0

answered 2015-06-03 02:06:15 +0800

hawk gravatar image hawk
3250 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2015-06-03 02:06:44 +0800

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">

link publish delete flag offensive edit
Your answer
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
1 follower

RSS

Stats

Asked: 2015-06-02 16:54:43 +0800

Seen: 23 times

Last updated: Jun 05 '15

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