-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show dropdown with default suggestions if minLength is 0 #719
Conversation
+1 - I hope this can be integrated rather quickly since it's definitely makes typeahead more usable and follows other trends in UI. |
It shows the default suggestions, but if you start typing the default suggestions are not filtered. |
+1 |
From the quick glance I just took, seems like a solid pull request. I'll take a closer look when I get a chance and let you know if I feel anything needs to be changed. Thanks for submitting this. |
if (matches.length < this.limit && this.transport) { | ||
cacheHit = this._getFromRemote(query, returnRemoteMatches); | ||
if (query === '') { | ||
matches = this.index.serialize().datums.slice(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add SearchIndex#all
so that we don't have to reach into the internals of SearchIndex here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@jharding I have some code in this PR to remove the placeholder attribute on the input when the hint is shown, and add it back when the hint is removed. I was on the fence about doing this or alternatively not showing a hint when the query is empty. Thoughts? |
@Saftpresse99 Do you have an example of this? Maybe you're using different options than what I tested with. |
👍 for this feature :) |
+1 |
+1 for remote. Also maybe think about making triggering configurable? Only on focus might be useful, but annoying in other cases, but one still might want to hook in to the "show all" with e.g. a click-event from whatever. 0.10.* is an awesome rewrite, btw. |
Would make sense if the prefetched data can be the default suggestions. |
@mokesmokes: agreed, 👍 for this feature in general |
@mokesmokes I've been using it with prefetched data for the default suggestions. |
@maurizi Can you please post a usage example? I am porting this project to the Titanium mobile framework, and in the course of that port added an initialData property to the dataset options - probably similar to yours. I also exported readFromStorage from Bloodhound, call that during the Bloodhound initialization done method, and then initialize the typeahead with that initial data in the dataset. |
@mokesmokes The only thing you should need to do to get default suggestions to show up is pass 0 as the
|
👍 Looks good! |
@maurizi I'm trying to use this feature in my code, but it looks like I'm doing something wrong. This is my code:
Any idea about what I'm doing wrong? |
@yoanisgil I haven't used this with local, maybe I messed something up. I'll investigate this as soon as I can and see what's going on. Though I will say that |
@maurizi fwiw, I was able to get this to work by extracting some bits of your changes into the current version of typeahead. But when building yours my typeahead failed silently. |
I will try to put together a more comprehensive example, but I cannot get this feature to work out of the box. For instance I cloned your typeahead fork and included the bundled file in my project, and that did not work. Seems like I need to build with bower first before I can use it, right? Le 2014-04-10 à 09:35 PM, Michael Maurizi [email protected] a écrit :
|
@yoanisgil Did you run grunt to rebuild the bundled files? Per the project standards, I didn't rebuild the files in |
No, I did not … but I’m also knew to grunt. Will do that and see what comes up. Will keep you posted.
|
@yoanisgil should be able to run npm install then grunt. |
+1 |
2 similar comments
+1 |
+1 |
Any chance that this is getting released any time soon (say 1 month period)? |
I have manually made these same changes (from azavea's branch) to 10.5 and it works like a charm. |
+1 |
1 similar comment
+1 |
Any chance these merge conflict to get resolved anytime soon? |
👍 |
Is there a simple hack to implement like it was the case in previous version (on click event)
|
+1 |
+1 - it would be good to provide an unfiltered list on downKeyed for discoverability purposes |
+1 |
Just a small hackish way to accomplish this for those still struggling:
|
+1 |
2 similar comments
+1 |
+1 |
+1 👍 Would also like to use this to show previous searches when the input element receives focus. |
v0.11 just shipped and it adds support for displaying the menu when |
#praisejesus — On Sat, Apr 25, 2015 at 3:32 AM, Jake Harding [email protected]
|
Mostly captures the changes in #390, but updated for typeahead v0.10
Ditches #390's concept of
defaultSort
since there is now sorting builtin.