Monday, August 26, 2013

suggest box with rpc call - question

Hi everyone,

I am placing an suggestbox on the front interface whhere upon typing any value or letter corresponding list matching to that letter needs to appear. 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 pulls all the values from database starting with letter 'D'. This list will be added to the oracle object as shown in the response of RPC call. So, my 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 shwon in the same event. How can I achieve this? 


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()) {
datamartClientImpl.retrieveNATLData(tablename);
}
}

});

Response from RPC call
public void updateSuggestBox(DomesticDMAHistBean domesticDMAHistBean) {
oracle.addAll(domesticDMAHistBean.getNatldesc()); // obtaining the list with startin letter 'D'
hPanel.remove(Metrics);
hPanel.remove(bttnDomesticNATLHist);
vPanel.clear();
vPanel.add(suggestBox);
hPanel.add(vPanel);
hPanel.add(Metrics);
hPanel.add(bttnDomesticNATLHist);
}

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment