src/dropdown.js
function(term) {
        this.term = term;

        if (this.options.items) {
            term = Selectivity.transformText(term);
            var matcher = this.selectivity.options.matcher || Selectivity.matcher;
            this._showResults(
                this.options.items
                    .map(function(item) {
                        return matcher(item, term);
                    })
                    .filter(function(item) {
                        return !!item;
                    }),
                { term: term }
            );
        } else if (this.options.query) {
            this.options.query({
                callback: function(response) {
                    if (response && response.results) {
                        this._showResults(Selectivity.processItems(response.results), {
                            hasMore: !!response.more,
                            term: term
                        });
                    } else {
                        throw new Error('callback must be passed a response object');
                    }
                }.bind(this),
                error: this.showError.bind(this),
                offset: 0,
                selectivity: this.selectivity,
                term: term
            });
        }
    }
function(term) {
        this.term = term;

        if (this.options.items) {
            term = Selectivity.transformText(term);
            var matcher = this.selectivity.options.matcher || Selectivity.matcher;
            this._showResults(
                this.options.items
                    .map(function(item) {
                        return matcher(item, term);
                    })
                    .filter(function(item) {
                        return !!item;
                    }),
                { term: term }
            );
        } else if (this.options.query) {
            this.options.query({
                callback: function(response) {
                    if (response && response.results) {
                        this._showResults(Selectivity.processItems(response.results), {
                            hasMore: !!response.more,
                            term: term
                        });
                    } else {
                        throw new Error('callback must be passed a response object');
                    }
                }.bind(this),
                error: this.showError.bind(this),
                offset: 0,
                selectivity: this.selectivity,
                term: term
            });
        }
    }
function ( term ) { this . term = term ; if ( this . options . items ) { term = Selectivity . transformText ( term ) ; var matcher = this . selectivity . options . matcher || Selectivity . matcher ; this . _showResults ( this . options . items . map ( function ( item ) { return matcher ( item , term ) ; } ) . filter ( function ( item ) { return ! ! item ; } ) , { term : term } ) ; } else if ( this . options . query ) { this . options . query ( { callback : function ( response ) { if ( response && response . results ) { this . _showResults ( Selectivity . processItems ( response . results ) , { hasMore : ! ! response . more , term : term } ) ; } else { throw new Error ( 'callback must be passed a response object' ) ; } } . bind ( this ) , error : this . showError . bind ( this ) , offset : 0 , selectivity : this . selectivity , term : term } ) ; } }
Searches for results based on the term given.

If an items array has been passed with the options to the Selectivity instance, a local
search will be performed among those items. Otherwise, the query function specified in the
options will be used to perform the search. If neither is defined, nothing happens.

@param term Term to search for.
Searches for results based on the term given .