-
FEATURED COMPONENTS
First time here? Check out the FAQ!
How to get in MyComposer which item is selected from combobox ? I get null :(
<window id="autowin" apply="ui.MyComposer"> <combobox id="combo" selectedIndex="@{autowin$MyComposer.selected}"/> </window> public class AutoComposer extends GenericForwardComposer { Object selected; public void onChanging$combo(Event evt) { System.out.println(selected); // null } }
If you set a model to the combobox, you can set the selection to model,
please refer to the component reference.
Thanks caclark
I tried this way before, but control was not coming in onCreate method, reason could be I declared this method without 'ForwardEvent' paramater. Will try this too.
Meanwhile, there is another way around :
In .zul file
<combobox id="billCountry"
onCreate="self.setSelectedIndex(editCompanyInfoWin$composer.getCurrentBillCountryIndex())">
.....
.....
</combobox>
Many thanks,
AJaikda
Hook the onCreate event of that component in your composer and do whatever you need to do...
public void onCreate$myComponentId(ForwardEvent event) { ((Listbox)event.getOrigin()).setSelectedIndex(....) }
Thank You very much as1225 :)
<combobox onCreate='self.setSelectedIndex(0);'>
My combo another:
<combobox id="autoType"> <comboitem label="osobowy" value="0"/> <comboitem label="ciężarowy" value="1"/> </combobox>
<combobox id="autoType" selectedIndex="0">
combo.setSelectedIndex(0);
As said by as1225, you can set the combobox as readonly.
So, users can only choose from the available options.
Hi,marioosh
you can try
<zk> <combobox id="cb" > <comboitem label="Simple and Rich"/> <comboitem label="Cool!"/> <comboitem label="Ajax and RIA"/> </combobox> <button label="readonly" onClick='cb.setReadonly(true);'/> <button label="disable" onClick='cb.setDisabled(true);'/> <button label="edit" onClick='cb.setReadonly(false);cb.setDisabled(false);'/> </zk>
I have another question: How to block user for input something isn't in combobox ? :)
Do I have to do it myself or is there any method in api which does that ?
Asked: 2009-12-02 06:31:09 +0800
Seen: 4,613 times
Last updated: Jun 08 '11