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

Using typeahead #11

Closed
sangyoo91 opened this issue Apr 2, 2015 · 6 comments
Closed

Using typeahead #11

sangyoo91 opened this issue Apr 2, 2015 · 6 comments

Comments

@sangyoo91
Copy link

$('.tagsinput').tagsinput({
        confirmKeys: [13, 32, 188], //Enter Space Comma
        maxTags: 5,
        trimValue: true,
        maxChars: 16,
        tagClass: 'label label-default tagCustom',
        typeahead: {
            source: ['css', 'javascript', 'jquery', 'meteor', 'mongodb', 'php', 'mysql', 'clojure', 'html', 'less']
        },
        freeinput: true
    });

This is not working for me.
I don't see a dropdown for typeahead. What is the problem?

How would I use typeahead?

@ajduke
Copy link
Owner

ajduke commented Apr 4, 2015

I did not tested typeahead after porting repo, but let me check if anything missing
But Did you try adding the typeahead.js ?

@sangyoo91
Copy link
Author

@ajduke I have tried this with https://atmospherejs.com/sergeyt/typeahead. I've had no luck :(

@ajduke
Copy link
Owner

ajduke commented Apr 7, 2015

I will check it out tonight and will let you know.

Thanks
/ajduke

@sangyoo91
Copy link
Author

@ajduke Thanks: ) Please let me know

@sangyoo91
Copy link
Author

Is there any progress on this?

@ajduke
Copy link
Owner

ajduke commented Jun 27, 2015

I installed typeahead package from Atomsphere and put the following code in rendered function of template-

I guess you need to use the Bloodhound Suggestion engine with adapter as shown in following code.

Template.hello.rendered = function(){

    var citynames = new Bloodhound({
      datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
      queryTokenizer: Bloodhound.tokenizers.whitespace,
      local: [{name:"one"}, {name:"two"}, {name:"three"}]
    });
    citynames.initialize();

    $('.typeahead').tagsinput({
      typeaheadjs: {
        name: 'citynames',
        displayKey: 'name',
        valueKey: 'name',
        source: citynames.ttAdapter()
      }
    });
  }

and html as follows -

<input class="typeahead" name="team" type="text">

Hope this helps.

I am closing for this now.

@ajduke ajduke closed this as completed Jun 27, 2015
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