0

Listbox with size and selectIndex

asked 2012-02-10 21:47:38 +0800

satan87 gravatar image satan87
255

Hello

I got a listbox for which i have limited the size

<listbox id="lsttvshows" rows="11" onSelect='addSelectSeason("")' />

When i do :

((Listbox)((Window)winadd.getFellow("winaddtop")).getFellow("lsttvshows")).setSelectedIndex(it);

It's working fine, the element is well selected, BUT
on screen, i'm still seiing the first 11 objects

is there any way to make the list "moved" to the good element ?

thanks
nicolas

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-02-23 02:33:47 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

Would you provide a test case that will replicate your issue? And also which ZK version you are using?

I tried following test case in ZK6 and it works:

<window>
<zscript><![CDATA[
org.zkoss.zul.ListModelList strset = new org.zkoss.zul.ListModelList();
for(int j =0; j < 20000; ++j) {
strset.add("Option - "+j);
}
]]></zscript>
<listbox id="list" width="200px" rows="10" model="${strset}">
<listhead>
<listheader label="Load on Demend" sort="auto"/>
</listhead>
</listbox>
<button label="Select 200" onClick="strset.addSelection(strset.getElementAt(200))"/>
</window>

link publish delete flag offensive edit

answered 2012-02-27 23:12:00 +0800

satan87 gravatar image satan87
255

I find this solution, which is working for me

Clients.scrollIntoView(lsttvshows.getSelectedItem());

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: 2012-02-10 21:47:38 +0800

Seen: 124 times

Last updated: Feb 27 '12

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