reagent-project / reagent-forms

Bootstrap form components for Reagent
339 stars 78 forks source link

Typeahead usability improvements #63

Closed blak3mill3r closed 8 years ago

blak3mill3r commented 8 years ago

Here are a few changes which I had to make to get the typeahead to work well for me:

With these changes, I find it feels very nice and looks great with bootstrap (and I'm using FlatUI as well)

Feedback welcome. Cheers!

yogthos commented 8 years ago

looks great!

blak3mill3r commented 8 years ago

with the quickness!

yogthos commented 8 years ago

just pushed out 0.5.3 to Clojars with the changes

asok commented 7 years ago

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?

blak3mill3r commented 7 years ago

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.