0

Listbox behavior

asked 2008-07-31 21:56:53 +0800

plagonell gravatar image plagonell
63

Hi, in my app i generate listbox dinamically, in some cases the listbox contains one listitem, and onSelect don't work. i take the demo example :
<window title="listbox demo" border="normal">
<vbox>
<listbox rows="1" mold="select" onSelect="alert(self.getSelectedItem().getValue())">
<listitem value="1" label="option1"/>
<listitem value="2" label="option2"/>
<listitem value="3" label="option3"/>
</listbox>

<separator bar="true"/>
<listbox width="250px">
<listhead sizable="true">
<listheader label="name" sort="auto"/>
<listheader label="gender" sort="auto"/>
</listhead>
<listitem>
<listcell label="Mary"/>
<listcell label="FEMALE"/>
</listitem>
<listitem>
<listcell label="John"/>
<listcell label="MALE"/>
</listitem>
<listitem>
<listcell label="Jane"/>
<listcell label="FEMALE"/>
</listitem>
<listitem>
<listcell label="Henry"/>
<listcell label="MALE"/>
</listitem>
</listbox>
</vbox>
</window>
and i try to select the first time the option1 ???, only it's selected when i select other option than 1, and if i delete the option2 and option3, how i can select the option1 or fired the onSelect, in my case (zk-3.0.6 Live demo).
any clue?

PD: i apologize for my english

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2008-07-31 22:38:49 +0800

plagonell gravatar image plagonell
63

Hi, i excuse for this thread, i found the solution, after a long time work i don't see well.

link publish delete flag offensive edit

answered 2008-08-01 01:52:31 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

ZK optimize the onSelect event so that there are not much "unnecessary" traffic between browser and server. That is the reason why you cannot "reselect" the same item.

In your usecase, you seems using listitem as a button. Each time the listitem is clicked, something has to happen.
Maybe you want to register onClick event on listitem rather than onSelect event on listbox. Another way, always "clear" the selection in onSelect so it is always unselected and can be selected again.

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-07-31 21:56:53 +0800

Seen: 181 times

Last updated: Aug 01 '08

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