Event's with Auto-Complete 4.1
A big advantage to autoComplete, is it's internal trigger system. It comes with a set of predefined triggers that take some common, but difficult, tasks and simplifies them into a single function call. I've outlined each of them below.
.autoComplete('settings', object newSettings)
The settings trigger allows for changes to the settings for that inputs autoComplete at any point of time. This can be very useful if the metadata plugin is not installed, yet separate functionality is needed for each input. Simply initiate the autocomplete on each input, and use the settings trigger to attach special parameters to each input's autoComplete instance.
.autoComplete('flush', boolean cacheOnly)
The flush trigger clears out the inner cache of results, as well as the number of requests made. And optional, second boolean parameter can be passed if only the cache needs to be flushed, not the number of requests made.
.autoComplete('destroy')
The destroy trigger unbinds that inputs autoComplete event's.
.autoComplete('button.ajax', object postData, string cacheName)
The button.ajax trigger allows for sending requests through an external trigger(button). It's recommended a special post var is passed to differentiate between a normal request and a triggered request. This can enable a sort of select drop down functionality, where clicking a button can show the whole list, or users can just use the autoComplete to find their selection.
.autoComplete('button.supply', array data, string cacheName)
The button.supply trigger is essentially the same as the button.ajax trigger, except it works with a localized set of results instead of through an ajax requests. Additionally, an optional second data parameter can be passed to supply a different set of results on just this trigger, instead of the normal set supplied during initialization.
For example's of these in action, take a look at the demo page, and don't forget to read up on the docs for a better understanding.
RSS