How to set index to listbox on loading
2 Sep 2010 05:20:26 GMT
2 Sep 2010 05:56:01 GMT
2 Sep 2010 05:56:01 GMT
Hi Tanaka,
You can use onCreate like this
<listbox id="todoubox" mold="select" onCreate="self.setSelectedIndex(3)"> <listitem label="A" /> <listitem label="B" /> <listitem label="C" /> <listitem label="D" /> <listitem label="E" /> </listbox>
Or to set it up via zscript like this
<zk> <listbox id="todoubox" mold="select"> <listitem label="A" /> <listitem label="B" /> <listitem label="C" /> <listitem label="D" /> <listitem label="E" /> </listbox> <zscript> todoubox.setSelectedIndex(2); </zscript> </zk>
Regards,
Simon
2 Sep 2010 08:13:45 GMT
2 Sep 2010 08:13:45 GMT
SimonPai san,
Thank you for your nice advice !!
My appli works quit well as following.
<listbox id="todoubox" mold="select"
onSelect="onTodouSel(self.getSelectedIndex())">
<attribute name="onCreate">
self.setSelectedIndex(ckTdCD);
</attribute>
</listbox>
ZK - Open Source Ajax Java Framework
Hi,
I'm a biginer of ZK. and i have a trouble about the title.
Can anyone help me ?
I layouted the listbox such as following codes.
<listbox id="todoubox" mold="select"
onAfterRender="self.setSelectedIndex(${ckTdCD})"
onSelect="onTodouSel(self.getSelectedIndex())">
Variable "ckTdCD" is cookie saved last condition value.
And i intend to locate it on my cookie saved index,
but can't be located, can't affect, and alwaws be located on top item.
And i tried zscript as following.
<zscript language="Java">
Listbox tdbox = (Listbox)todoubox;
tdbox.setSelectedIndex(ckTdCD);
the code throws error such as
java.lang.ClassCastException: Cannot cast void value to org.zkoss.zul.Listbox
Is there any solution on this problem ??