tags:

views:

162

answers:

2

Is there anyway to have the autocomplete for a combo box to start from anywhere in the text, let me give you an example. If I have someone named john smith in the combobox if I start with the letter 'j' it pulls up john smith but less say I want to start with the letter 's' to search for his last name, is that possible, if so does anyone have code or a link to code that does this.

A: 

Please give more detail on where you are getting the auto complete data from. The simple answer is yes you can.

If its a database just use the LIKE query: $result = mysql_query("SELECT * FROM tablename WHERE columnname LIKE '%search query%' ORDER BY lastUpdated desc");

kalpaitch
I have a json file that is tranmitted from the server to the client, I parsed the file placed it in a store and set the combobox to display the store.
+4  A: 

Have you looked at SuggestBox? The MultiWordSuggestOracle that feeds the data to the suggest box seems to do exactly what you want - see the javadocs for usage and examples.

Update: Here's a rather nice example of customizing GWT's SuggestBox to look like the one on Facebook: http://raibledesigns.com/rd/entry/creating_a_facebook_style_autocomplete Be sure to follow all the links in that tutorial, as they contain a lot of info about using the SuggestBox.

Igor Klimer