jquery - How to troubleshoot Typeahead and bootstrap -
i have included jquery 2.1 bootstrap 3.x , latest typeahead. code:
<script type="text/javascript"> $(document).ready(function () { var bestpictures = new bloodhound({ datumtokenizer: bloodhound.tokenizers.obj.whitespace('value'), querytokenizer: bloodhound.tokenizers.whitespace, prefetch: { url: 'typeaheadprefetch.ashx', filter: function (list) { homecoming $.map(list, function (country) { alert(country); homecoming { name: country }; }); } }, remote: 'autocomplete.asmx/getsupersearchtypeahead?q=%query' }); bestpictures.initialize(); $("#tbssearch").typeahead(null, { name: 'best-pictures', displaykey: 'value', source: bestpictures.ttadapter() }); }); </script> <input type="text" id="tbssearch" placeholder="st super search" class="form-control" /> the prefetch.ashx returns ["a","b","c" etc. prefetched array of strings big should contain right result. there no need phone call remote. does!! why that? , why there no visible dropdown?
the console of browser shows error in typeahead lib on row 134 col 12 on return s.split(/\s+/);
ps alert(country); works
in definition of "datumtokenizer" seek changing "value" "name" e.g. :
datumtokenizer: bloodhound.tokenizers.obj.whitespace('name'), "value" doesn't exist in list of datums whereas "name" (see filter function) might causing problem.
similarly change
displaykey: 'value', to:
displaykey: 'name', i haven't tested reply it's awkward recreate problems using remote/prefetch info calls!
jquery typeahead.js bootstrap-typeahead
No comments:
Post a Comment