Monday, August 26, 2013

SuggestBox with keydownhandler event - Question

Hi everyone,

For my application, I am adding a suggestbox on the front interface so when user types in any letter corresponding list (we won't add the list to the interface. It will be shown as the user types in and changes correspondingly when the letters changes as we generally see in online websites) matching to that letter needs to appear on the front interface. I am using keydownhandler event to obtain this.As you can see the below code, I am making an RPC call to obtain the list of data from the oracle database . Suppose user has typed in letter 'D' the following query runs 
"String sql = "select NAME from DOM_REFERENCE_TABLE where DESCRIPTION = 'NationalAccountDetails' AND NAME LIKE upper ('" + tablename +"%') ORDER BY NAME ASC";

where tablename value is 'D', so it gets all  values starting with letter 'D' from database. This list will then be added to the oracle (MultiWordSuggestOracle) object as shown in the below code(see at Response of RPC call Tag). So, the problem is the list that needs to appear when user types in letter'D' doesn't happen for the first time but happens when user types in Next time. I guess you people understood what I am trying to say. As the list gets added to oracle with keydown event it is not showing at that time but it will show for next event. But I need the matching list to be shown in the same event. How can I achieve this? Any suggestions? Let me know I need to clarify more on this. Thanks in advance


// Object Declaration
private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
private SuggestBox suggestBox = new SuggestBox(oracle);

// Key down event:
suggestBox.addKeyDownHandler(new KeyDownHandler(){
public void onKeyDown(KeyDownEvent event) {
// TODO Auto-generated method stub
String tablename = suggestBox.getValue();
if (tablename != null && !tablename.isEmpty()) {


// Response from RPC call
public void updateSuggestBox(DomesticDMAHistBean domesticDMAHistBean) {
oracle.addAll(domesticDMAHistBean.getNatldesc()); // obtaining the list with startin letter 'D'

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment