Interface Dataset

A dataset is an object that defines a set of data that hydrates suggestions. Typeaheads can be backed by multiple datasets. Given a query, a typeahead instance will inspect its backing datasets and display relevant suggestions to the end-user.

Index

Properties

Properties

optional public engine?: string

The template engine used to compile/render template if it is a string. Any engine can use used as long as it adheres to the expected API. Required if template is a string.

optional public footer?: any

The footer rendered after suggestions in the dropdown menu. Can be either a DOM element or HTML.

optional public header?: any

The header rendered before suggestions in the dropdown menu. Can be either a DOM element or HTML.

optional public limit?: number

The max number of suggestions from the dataset to display for a given query. Defaults to 5.

optional public local?: Array<any>

An array of datums or strings.

public name: string

The string used to identify the dataset. Used by typeahead.js to cache intelligently.

optional public prefetch?: any

Can be a URL to a JSON file containing an array of datums or, if more configurability is needed, a prefetch options object.

optional public remote?: any

Can be a URL to fetch suggestions from when the data provided by local and prefetch is insufficient or, if more configurability is needed, a remote options object.

optional public template?: any

The template used to render suggestions. Can be a string or a precompiled template. If not provided, suggestions will render as their value contained in a

element (i.e.

value

).

optional public valueKey?: string

The key used to access the value of the datum in the datum object. Defaults to value.