sliptree / bootstrap-tokenfield

A jQuery tag/token input plugin for Twitter's Bootstrap, by the guys from Sliptree
http://sliptree.github.io/bootstrap-tokenfield/
Other
859 stars 238 forks source link

typeahead problem: Cannot read property 'toString' #268

Open antonioaltamura opened 8 years ago

antonioaltamura commented 8 years ago

this is my code

var engine = new Bloodhound({
        remote: {
            url: '/api/community/users?q=%QUERY',
            wildcard: '%QUERY'
        },
        datumTokenizer: function(d) {
            return Bloodhound.tokenizers.whitespace('name');
        },
        queryTokenizer: Bloodhound.tokenizers.whitespace
    });

    engine.initialize();
    $('#tokenfield-typeahead').tokenfield({
        typeahead: [null, {
            display: 'name',
            source: engine.ttAdapter() }]
    });

my json is the form: [{"_id":"56a6b050d3a7b8b811324d64","name":"John","age":20,"__v":0}]

when I select an element from typeahead dropdown I get an error: Uncaught TypeError: Cannot read property 'toString' of undefined

antonioaltamura commented 8 years ago

I guess it's the same problem of this https://github.com/sliptree/bootstrap-tokenfield/issues/189