我想在組合框中獲取選定的值,但它作爲ComboItem返回。如何獲取值作爲字符串?ZK從組合框中獲取選定的項目
<zscript>
<![CDATA[
String[] months = { "Ada", "Basic", "C", "C++", "Cobol", "Forth",
"Fortran", "Go", "Groovy", "Haskell", "Java", "JavaScript", "Lisp",
"Python", "Ruby", "Scala", "Scheme" };
ListModel lmonths = new SimpleListModel(months);
]]></zscript>
<combobox id="searchCombo"
forward="onChange=onSearch" model="@{months}" >
<!--
<comboitem self="@{each='months'}"
label="@{months}" value="@{months}">
</comboitem>
-->
</combobox>
在這裏,我onSearch方法
public void onSearch(ForwardEvent event) {
System.out.println(searchCombo.getSelectedItem());
prodevt.search(searchCombo.getSelectedItem().toString());
filterCbox.setChecked(true);
AnnotateDataBinder binder = (AnnotateDataBinder) win.getVariable(
"binder", true);
binder.loadAll();
}