YUI Library Home

YUI Library Examples: AutoComplete Control: Subset Matching

AutoComplete Control: Subset Matching

This example demonstrates AutoComplete's queryMatchSubset property. The first instance of AutoComplete has queryMatchSubset enabled for maximum cache performance such that as you type, the query is searched within previously cached results. For best results, the DataSource should return a complete set of results when a single letter is queried such that subset matching will also return a complete set of results.

The second AutoComplete instance does not enable queryMatchSubset so each typed letter results in a new request to the server.

Note the custom CSS that is needed for stacking AutoComplete instances.

Note: The flat-file database accessed here has a limited number of terms; for best results, type one-letter at at time and let the AutoComplete instance return — if you type a full, highly-specifc phrase (such as your name) you'll probably get no results from the small dataset.

Sample Code

Data:

CSS:

Markup:

JavaScript:

Configuration for This Example

You can load the necessary JavaScript and CSS for this example from Yahoo's servers. Click here to load the YUI Dependency Configurator with all of this example's dependencies preconfigured.

Copyright © 2009 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings