Skip to content

typeahead not showing all results if less than limit #1232

@islopma

Description

@islopma

I'm using typeahead with the following code:

$('#questionId .typeahead').typeahead(null, {
    name: 'questions',
    displayKey: 'question',
    source: questionsList,
    limit: 10,
    templates: {
        empty: '<p>message</p>',
        suggestion: Handlebars.compile('<p>{{question}}</p>')
    }
})

Where 'questionsList' is a Bloodhound instance. The suggestions seem to be working fine when the query's number of matches is greater than 'limit' (10 in this case). But the problem is when the number of matches is <= limit. In that case, the number of suggestions displayed is max(limit - results, results). For instance, in my case when the query returns 10 matches, 0 results are displayed. When the query returns 8 matches, 2 results are displayed. When the query returns 3 matches, 3 results are displayed, and so on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions