The typeahead expects an array of strings, and you're passing it an array
of JSON objects. If you want it to work that way, you could pass your own
updater, matcher, sorter and highlighter that can work with JSON items.
24 юли 2012, вторник, 04:29:17 UTC+3, netwire написа:
>
> Thanks for the clarification. I'm getting this error though:
> Uncaught TypeError: Object #<Object> has no method 'toLowerCase'
>
> $('#category_input').typeahead({source: gon.categories, items:6})
>
> I know that gon.categories is an json array that starts like
> this: window.gon = {};gon.categories=[{"id":"500d619583de4c9a30000008"...
>
> On Monday, July 16, 2012 1:05:03 PM UTC-4, Ivan Vergiliev wrote:
>>
>> The question is a bit old, but just in case anyone needs an answer:
>>
>> Bootstrap typeahead expects all data to come from the same place - so if
>> you have data-provide="typeahead", you also have to specify
>> data-source="[...]" and any other options you need. In case you want to
>> activate the typeahead in Javascript, just lose the
>> 'data-provide="typeahead"' and it should work.
>>
>> 26 февруари 2012, неделя, 13:02:05 UTC+2, Anuar Balgimbayev написа:
>>>
>>> hello guys!
>>> bootstrap's typeahead doesn't work in my hands.
>>>
>>> <script type="text/javascript"
>>> src="/bootstrap/js/bootstrap-typeahead.js"></script> (from git)
>>>
>>> <script type="text/javascript">
>>> var mas = ['Red', 'Green', 'Blue];
>>>
>>> $('.typeahead').typeahead({
>>> source: mas
>>> })
>>> </script>
>>>
>>> <td>
>>> <div>
>>> <input type="text" name="searchWord" style="width: 130px"
>>> placeholder="search" data-provide="typeahead" />
>>> </div>
>>> </td>
>>>
>>> what i'm doing wrong?
>>> thanks for any suggestions
>>>
>>>