-
Bug
-
Resolution: Fixed
-
Normal
-
6.0.0
-
None
Try the code below on sandbox,
click sim3 -> click single -> click 'show selection'
The label shows [1] but selected item at client is 3.
<zk> <window> <zscript><![CDATA[ org.zkoss.zul.ListModelList lml1 = new org.zkoss.zul.ListModelList(); for(int i=0;i<10;i++){ lml1.add(""+i); } void simbind(){ if(true) return; //to sim zkbind sequence, you can ignore this method, just check sim1 ..etc Object[] arr = lml1.getSelection().toArray(); lml1.clearSelection(); for(Object obj:arr){ lml1.addToSelection(obj); } } void sim3(){ lml1.addToSelection("3"); lml1.clearSelection(); lml1.addToSelection("1"); lml1.addToSelection("2"); lml1.addToSelection("3"); } void single(){ listbox.setMultiple(false); } void showSelection(){ msg.setValue(""+listbox.getModel().getSelection()); } ]]></zscript> <listbox id="listbox" model="${lml1}" checkmark="true" multiple="true" onSelect="//simbind()"> </listbox> <button label="sim3" onClick='sim3()'/> <button label="single" onClick='single()'/> <button label="show selection" onClick='showSelection()'/> <label id="msg" /> </window> </zk>