If the :data-source function returns a single element then this is automatically selected. This is not configurable as currently implemented, it seemed a subtle enough change not to upset anyone, but could be optional of course
If the typeahead list is long enough to scroll, the list doesn't autoscroll with the keyboard. Added code to fix this.
I wanted the full list to become visible without actually typing anything. I added code so down-arrow will display the list, which it does by calling :data-source passing the keyword :all. This isn't a breaking change, in that an empty list would be returned anyway if the client doesn't implement this.
This mod leaves the way open for adding a dropdown button, should someone want that.
If the :get-index function is supplied, when the list is popped down as above the current item is shown selected.
May be the selections list is the result of an ajax call using the text the user is typing and invoked from :data-source. In this case the ajax result handler would set an atom, so I added an option for this to be user-supplied via :selections.
See source code for the demo page for a full example.
Suggested additions to typeahead:
If the
:data-source
function returns a single element then this is automatically selected. This is not configurable as currently implemented, it seemed a subtle enough change not to upset anyone, but could be optional of courseIf the typeahead list is long enough to scroll, the list doesn't autoscroll with the keyboard. Added code to fix this.
I wanted the full list to become visible without actually typing anything. I added code so down-arrow will display the list, which it does by calling
:data-source
passing the keyword:all
. This isn't a breaking change, in that an empty list would be returned anyway if the client doesn't implement this. This mod leaves the way open for adding a dropdown button, should someone want that.If the
:get-index
function is supplied, when the list is popped down as above the current item is shown selected.May be the selections list is the result of an ajax call using the text the user is typing and invoked from
:data-source
. In this case the ajax result handler would set an atom, so I added an option for this to be user-supplied via:selections
.See source code for the demo page for a full example.