twitter/typeahead.js — pull request #953 by migg24 (2014-08-19 07:34:35+00:00)
Title: Grouping by category from datum object

Added categories to the dropdown that are coming from the datum objects. For every new category in the next datum object it adds an unselectable ``tt-sugestion-category`` element before the suggestion containing the new category.

Related to comment https://github.com/twitter/typeahead.js/issues/11#issuecomment-13857058

Usage:

$('#the-basics .typeahead').typeahead({
hint: true,
highlight: true,
minLength: 1
},
{
name: 'cities',
displayKey: 'name',
displayCategory: 'state',
source: substringMatcher(states)
});

Assuming a city datum object looking like this:

{
name: "Montgomery",
state: "Alabama"
}

Also added a ``templates.category.header`` to use a custom category header template.