Closed blak3mill3r closed 8 years ago
looks great!
with the quickness!
just pushed out 0.5.3
to Clojars with the changes
Hi @blak3mill3r I was trying to use typeahead by returning a vector from the data source. But I don't quite get how to use it. Could you please elaborate on this?
Hey @asok ... my memory of these changes are imperfect, but IIRC if you make your data-source return a vector (with an id and a label perhaps), then the typeahead will pass those vectors to your result-fn
instead of a plain string (so you almost certainly want to override result-fn
if your data-source returns something that you don't want to include as-is in the rendering of the typeahead results).
Also the same 2-element vector (or, whatever data-source
returns) will become the value of the model when the user makes a selection... so you can then do whatever you want, like passing just the id
value to a server.
Here are a few changes which I had to make to get the typeahead to work well for me:
<a>
tag in each element, or nothing is shown)[name id]
from data-sourcestyle
attr on the dropdown for showing/hiding (bootstrap3 css has a ruledisplay:none;
on the class.dropdown
which breaks the typeahead before these changes)choice-fn
)With these changes, I find it feels very nice and looks great with bootstrap (and I'm using FlatUI as well)
Feedback welcome. Cheers!