views:

71

answers:

1

I want to implement a 'live search' or 'search suggestions' feature in a web application that uses the Dojo Framework. It would be similar to the way Google and Bing searches display matches as you type: when you type in the search box, a list of potential matches appears below. Searches would be performed server side, with the results sent back to the browser using AJAX.

Does anyone know of a good way to implement this using Dojo?

Here are some potential options:

  • The built-in widget dijit.form.ComboBox
    This has very similar functionality, but I've only seen it used with limited data sets. The examples always use small lists (such as the 50 states in USA) and preload the entire data set for client-side filtering. However I presume I could hook it up to a dojox.data.JsonQueryRestStore for server-side search — can anyone confirm whether that works?

  • QueryBox http://marumushi.com/code/querybox/
    This implementation mainly does the job, but it has some minor bugs and doesn't look like it's being maintained. I'd have to do some bugfixes on the code before using it.

  • Medryx http://blog.medryx.org/2008/09/10/dijitsearch-part-2/
    This also looks like it does the job, but it is described as 'alpha-level' code and the link to the code seems to be broken...

I could probably make one of the above work, but I'd like to know if there are any better alternatives out there.

+3  A: 
Eugene Lazutkin
Thanks! Your solution is remarkably close to what I was looking for. I am currently writing an updated script for Dojo 1.5 and will probably post it here once I'm done.
gutch
Please do. This is a useful piece of code, which I can use myself. ;-)
Eugene Lazutkin