Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data being returned but dropdown not showing #116

Open
niranjans opened this issue Oct 5, 2015 · 2 comments
Open

Data being returned but dropdown not showing #116

niranjans opened this issue Oct 5, 2015 · 2 comments

Comments

@niranjans
Copy link

I noticed that a typeahead field that I had which was working earlier has stopped showing the results recently (or could be a couple months ago, not sure). I tried doing a console log and I see that the data is present from the Meteor.call.

When I inspect the element, I see classes tt-menu tt-empty tt-open instead of tt-dropdown-menu from what I remember from before. Are those classes what they should be when there is data returned?

Here is the helper which I have tested and is working:

        typeahead: function () {
         return [
                     {
                 name: 'gearCategories',
                 valueKey: 'label',
                 displayKey: 'label',
                 source: function(query, callback) { Meteor.call("typeAheadCategories",  query, {}, function(err, res) { if (!err) callback(res); }); },
                 header: '<h4 class="tt-header">Categories</h4>'
             },
                         {
                 name: 'gearSubCategories',
                 valueKey: 'label',
                 displayKey: 'label',
                 source: function(query, callback) { Meteor.call("typeAheadSubCategories",  query, {}, function(err, res) { if (!err) callback(res); }); },
                 header: '<h4 class="tt-header">Sub Categories</h4>'
             },
             {
                 name: 'gearBrands',
                 valueKey: 'name',
                 displayKey: 'name',
                 source: function(query, callback) { Meteor.call("typeAheadBrands",  query, {}, function(err, res) { if (!err) callback(res); }); },
                 header: '<h4 class="tt-header">Brands</h4>'
             }
         ];
    }

And the input text:

    <div class="form-group has-feedback no-margin">
            <input aria-label="Search" type="text" class="form-control typeahead no-padding" name="brand" id="searchGr" placeholder="Search"  autocomplete="off" spellcheck="off" data-sets="typeahead" value={{value}}>
        <i class="search-icon form-control-feedback"></i>
    </div>  
@sergeyt
Copy link
Owner

sergeyt commented Oct 5, 2015

@niranjans since typeahead.js v0.11 source function takes three arguments, last one is async callback, second one is sync callback.

@niranjans
Copy link
Author

Oh got it. I tried looking at the change-logs but could not find a breaking change. Thanks for pointing that out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants