what wrong in my zkoss code
I am getting the key press of each word and I need to make an autosuggest in a combobox. My code is the following:
<zk>
<window border="normal" appl开发者_StackOverflowy="org.test.test" id="win" >
<combobox id="combo" autodrop="true"/>
</window>
</zk>
The GenericForwardComposer
:
public class test extends GenericForwardComposer{
Combobox combo; //ZK Auto Wired , use combo directly
public void onChanging$combo() { // ZK Autoforward (Awesome !!)
suggest();
}
public void suggest() {
System.out.println(combo.getText());
combo.getItems().clear();
combo.appendItem("Ace");
combo.appendItem("Ajax");
combo.appendItem("Apple");
combo.appendItem("Best");
combo.appendItem("Blog");
}
}
This is not printing the first key when I press a key. Can I please get some help to know why????
When onChanging is received, the value of combobox is not changed yet. You have to get the value from the event
public void onChanging$como(InputEvent event) {
event.getValue(); //<- the value of combobox being entered so far
精彩评论