having issue with Listbox selecting rows. after upgrading zk lib from 5.0.5 to 5.0.10.
20 Jan 2012 15:17:13 GMT
6 Feb 2012 04:32:28 GMT
6 Feb 2012 04:32:28 GMT
Hi
could you provide a example. I tried my case, it doesn't show this issue.
<zk>
<zscript><![CDATA[
java.util.List model = new ArrayList();
for(int i=0;i<100;i++){
model.add("Item "+i);
}
public void onSelect(){
Set listitems = list.getSelectedItems();
System.out.println("list size = " + listitems.size());
for (Object listitem : listitems) {
System.out.println("value = " + listitem.getValue());
}
}
]]></zscript>
<listbox id="list" width="200px" rows="10" onSelect="onSelect()" multiple="true">
<listhead>
<listheader label="Load on Demend" sort="auto"/>
</listhead>
<listitem forEach="${model}" label="${each}" value="${each}"></listitem>
</listbox>
</zk>6 Feb 2012 04:35:10 GMT
6 Feb 2012 04:35:10 GMT
by the way, if you use model , you should get selection from model. not from listbox.getSelectedItem.
15 Feb 2012 07:59:31 GMT
15 Feb 2012 07:59:31 GMT
I have the same problem. When I specify the Library Property "org.zkoss.zul.listbox.rod" in the zk.xml to "true", it works.
<library-property>
<name>org.zkoss.zul.listbox.rod</name>
<value>true</value>
</library-property>16 Feb 2012 00:49:02 GMT
16 Feb 2012 00:49:02 GMT
you should use model to get the selection, not from listbox.getItems when use model,
if you use CE or EE version and enable ROD. listbox only maintain a sub-set of listitems , that is why you will get 0 when scroll down to the bottom.
ZK - Open Source Ajax Java Framework
I am having issue with Listbox selecting rows after upgrading zk lib from 5.0.5 to 5.0.10.
When I select multiple items in Listbox by holding the shift key getSelectedItems() method return 0 rows.
It’s returning selected rows if I use ctrl + click. In version 5.0.5 it’s selecting rows without any problems by
holding shift or ctrl
Use case.
1. Selecting row one.
2. Scrolling down to row 30.
3. Holding shift + click on row 30
4. All rows is selected
5. getSelectedItems().size() return 0
Here is sample of my code which working fine in 5.0.5
public void onSelect$lbProductGroup(ForwardEvent event)throws Exception{
Listbox listbox = (Listbox) event.getOrigin().getTarget();
Set<Listitem> listitems = (Set<Listitem>)listbox.getSelectedItems();
System.out.println("list size = " + listitems.size());
for (Listitem listitem : listitems) {
System.out.println("value = " + listitem.getValue().toString());
System.out.println("description = " + listitem.getLabel());
}
}