src/dropdown.js
function(results, options) {
        if (options.add) {
            removeElement(this.$('.selectivity-loading'));
        } else {
            this.resultsContainer.innerHTML = '';
        }

        var filteredResults = this.selectivity.filterResults(results);
        var resultsHtml = this.renderItems(filteredResults);
        if (options.hasMore) {
            resultsHtml += this.selectivity.template('loadMore');
        } else if (!resultsHtml && !options.add) {
            resultsHtml = this.selectivity.template('noResults', { term: options.term });
        }
        this.resultsContainer.innerHTML += resultsHtml;

        this.results = options.add ? this.results.concat(results) : results;

        this.hasMore = options.hasMore;

        var value = this.selectivity.getValue();
        if (value && !Array.isArray(value)) {
            var item = Selectivity.findNestedById(results, value);
            if (item) {
                this.highlight(item, { reason: 'current_value' });
            }
        } else if (
            this.options.highlightFirstItem !== false &&
            (!options.add || this.loadMoreHighlighted)
        ) {
            this._highlightFirstItem(filteredResults);
        }

        this.position();
    }
function(results, options) {
        if (options.add) {
            removeElement(this.$('.selectivity-loading'));
        } else {
            this.resultsContainer.innerHTML = '';
        }

        var filteredResults = this.selectivity.filterResults(results);
        var resultsHtml = this.renderItems(filteredResults);
        if (options.hasMore) {
            resultsHtml += this.selectivity.template('loadMore');
        } else if (!resultsHtml && !options.add) {
            resultsHtml = this.selectivity.template('noResults', { term: options.term });
        }
        this.resultsContainer.innerHTML += resultsHtml;

        this.results = options.add ? this.results.concat(results) : results;

        this.hasMore = options.hasMore;

        var value = this.selectivity.getValue();
        if (value && !Array.isArray(value)) {
            var item = Selectivity.findNestedById(results, value);
            if (item) {
                this.highlight(item, { reason: 'current_value' });
            }
        } else if (
            this.options.highlightFirstItem !== false &&
            (!options.add || this.loadMoreHighlighted)
        ) {
            this._highlightFirstItem(filteredResults);
        }

        this.position();
    }
function ( results , options ) { if ( options . add ) { removeElement ( this . $ ( '.selectivity-loading' ) ) ; } else { this . resultsContainer . innerHTML = '' ; } var filteredResults = this . selectivity . filterResults ( results ) ; var resultsHtml = this . renderItems ( filteredResults ) ; if ( options . hasMore ) { resultsHtml += this . selectivity . template ( 'loadMore' ) ; } else if ( ! resultsHtml && ! options . add ) { resultsHtml = this . selectivity . template ( 'noResults' , { term : options . term } ) ; } this . resultsContainer . innerHTML += resultsHtml ; this . results = options . add ? this . results . concat ( results ) : results ; this . hasMore = options . hasMore ; var value = this . selectivity . getValue ( ) ; if ( value && ! Array . isArray ( value ) ) { var item = Selectivity . findNestedById ( results , value ) ; if ( item ) { this . highlight ( item , { reason : 'current_value' } ) ; } } else if ( this . options . highlightFirstItem !== false && ( ! options . add || this . loadMoreHighlighted ) ) { this . _highlightFirstItem ( filteredResults ) ; } this . position ( ) ; }
Shows the results from a search query.

@param results Array of result items.
@param options Options object. May contain the following properties:
add - True if the results should be added to any already shown results.
dropdown - The dropdown instance for which the results are meant.
hasMore - Boolean whether more results can be fetched using the query()
function.
term - The search term for which the results are displayed.
Shows the results from a search query .