DataSource
This DataSource instance points to an in-memory JavaScript function that
returns results in an array. The function queries against an in-memory object
literal of data that holds the 50 US states and their corresponding postal
abbreviations.
AutoComplete
Since the DataSource for this example is already loaded into memory,
queries should be very fast to return data. Therefore, the AutoComplete
instance is configured to have a query delay of zero seconds. The
AutoComplete instance is also configured to display two data fields in its
container: the state and its corresponding postal abbreviation. By setting
the alwaysShowContainer property to true and customizing appropriate CSS styles, the
container has been implemented to always be displayed. Custom event handlers
have been hooked into containerExpandEvent and containerCollapseEvent to
dynamically update the always open container's contents.
Sample Code
CSS:
Markup:
JavaScript: