开发者

what wrong in my zkoss code

开发者 https://www.devze.com 2023-01-27 16:43 出处:网络
I am getting the key press of each word and I need to make an autosuggest in a combobox. My code is the following:

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
0

精彩评论

暂无评论...
验证码 换一张
取 消