twitter/bootstrap — Issue #1336: Add remote sources support for typeahead
Author: marcboeker
Created: 2012-01-28 08:59:07+00:00
State: open

Hi Mark,

the new typeahead component is awesome. But I often have to implement an autocomplete that is fetching data from a remote source. Would it be possible to add a callback, that I can use to query the remote server and return a set of items that match the entered query?

function(query) {
// Do some fetching and return an array of items.
}

The jQuery UI autocompleter offers returning an array of objects. This is very helpful, as you would often like to display a human friendly title to the user and set an ugly ID in the background as the field's value.

[{title: 'Look at me', value: '12345xyz'}, {title: 'Foo Bar', value: '654321abc'}]

I know, this increases the complexity of the typeahead component, but makes it on the other side very useful.

Thanks Marc