I've taken a few approaches to caching responses in the jQuery UI autocomplete widget. A response, in autocomplete parlance, is the data that's displayed when the user is typing in the text input. Each keystroke is a request for data — the response is something the autocomplete must generate by filtering some data source. The filtering operations can be done locally, or remotely. Either way, we stand to benefit from caching these responses.
Friday, July 4, 2014
Thursday, April 24, 2014
jQuery UI: Autocomplete With Select Elements
The jQuery UI autocomplete widget expects an input
as it's target element. It also expects a data source — the fundamental job of the autocomplete widget is tying these two things together. When the user starts typing, the autocomplete filters the data source, and offers the user a selection of possible input text values. When you think about it, the select
element is similar to the autocomplete.
Thursday, February 20, 2014
Using jQuery UI Tooltips With Autocomplete
The jQuery UI autocomplete widget can transform the way each individual item is rendered. By default, it only renders the data label. But that's easy to change by extending the autocomplete widget, and overriding the _renderItem()
method. For example, if each object in the autocomplete source has some specific field you would like rendered in the autocomplete drop-down, that's not difficult to implement. The challenge lies with finding enough space on the page to render this additional information. The auto complete already utilizes the menu widget to render the drop-down component — so why not utilize the tooltip widget as well?
Tuesday, February 4, 2014
Rendering Autocomplete Results In Another Div
The autocomplete widget uses the menu widget to display the filtered results. It does this by creating the markup necessary to render the menu, then creates the widget. It would be nice if we weren't limited to displaying the autocomplete results inside a drop-down menu. Thing about a list view — one where the list of items take up the majority of the space on the page. Just above this list, you have the autocomplete input. So instead of just displaying the drop-down menu, as the widget normally would, we would like the existing list to be filtered. It's easy enough to extend the autocomplete with this capability.
Monday, January 27, 2014
Sorting Autocomplete Responses For Relevancy
The autocomplete widget will search a given data source for the term the user has typed into the text box. This happens as the user types, so with each keystroke, there's potential for a new data response to be rendered. This response, however, doesn't do any sorting. For example, the user could type "games", which could yield hundreds of results. The autocomplete widget isn't going to display hundreds of items, because the user would have to use their eyes to sift throught the results, line-by-line, which kind of defeats the purpose of the widget. Rather than displaying the autocomplete items in the same order as the source data, we could first sort them by some criteria.
Wednesday, November 20, 2013
jQuery UI: Highlighting Autocomplete Text
Monday, October 21, 2013
Icons in jQuery UI Autocomplete Items
_renderItem()
method. It's one thing to include some meta data about each item in the autocomplete drop-down. It's much more interesting, I think, when you display icons beside each item. Ready?Thursday, March 25, 2010
jQueryUI 1.8
Wednesday, March 3, 2010
jQuery UI Select Menu
The auto-complete widget does look very promising, especially for large data sets. However, I have several instances where I have only a small data set and using an auto-complete widget would be overkill.
The select-menu widget looks perfect and I'm looking forward to a stable version in jQuery UI. It will be nice to replace the standard select elements, which look really out of place in a jQuery UI theme.