twitter bootstrap - Typeahed.js not filtering -
i using following code based on examples https://twitter.github.io/typeahead.js/examples/:
var cararray = [{ carid: 1, fullname: 'opel' }, { carid: 2, fullname: 'bmw' }, { carid: 3, fullname: 'mercedes' }]; var cars = new bloodhound({ datumtokenizer: bloodhound.tokenizers.obj.whitespace('fullname'), querytokenizer: bloodhound.tokenizers.whitespace, //local: cararray, remote: '/api/cars' }); cars.initialize(); $(elt).typeahead(null, { name: 'car', displaykey: 'fullname', source: cars.ttadapter() });
uncommenting local
works fine, remote
list not filtered, items.
so json returned remote
:
[{"carid":1,"optionone":"asd","optiontwo":"qew","fullname":"opel"}, {"carid":2,"optionone":"fas","optiontwo":"qew","fullname":"bmw"},{"carid":3,"optionone":"add","optiontwo":"qew","fullname":"mercedes"}]
thank you
Comments
Post a Comment