Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Default suggestion that always shows #858

Closed
leonardteo opened this issue May 27, 2014 · 2 comments
Closed

Default suggestion that always shows #858

leonardteo opened this issue May 27, 2014 · 2 comments
Milestone

Comments

@leonardteo
Copy link

Hi guys,

We're using Typahead for our search feature and I was wondering if there is a way that one can configure Typeahead so that as soon as a user focuses on the search bar, it will show a suggestion for "Advanced search". Then, as search results are returned from typing, the "Advanced Search" suggestion is always present?

Thanks in advance.

Leonard

@jharding jharding added this to the DOM and Style Customization milestone Jul 12, 2014
@jhuesos
Copy link

jhuesos commented Jul 23, 2014

Hi, you can achieve this very easily with typeahead but just to be clear the behavior to display suggestion on focus hasn't been merged yet. There is a PR opened and I really hope it will be merged very soon since it is being pending there for a while and I think this is a feature that many people is demanding (including my team)

For the second requirement, to always display a fixed value regardless what the user types, you can always add a new dataSet to typeahead with a custom dataset. I did this plunkr with a working example:

http://plnkr.co/edit/cjL6nZtShyxmLjWxzdBC?p=preview

Note that the source function you can do whatever you want. In our project, the source is a very complex function that can return different things depending on the current state of the widget.

And you can keep adding more and more datasets with different select handlers or styles: do you want to show before the results another fix value saying: open help or anything else, you just need to add another data set in the first place. I really love the flexibility typeahead give to you to get things like this done.

I dont think we need a new feature to do what you need.

@jharding jharding modified the milestones: DOM and Style Customization, v0.11.0 Aug 15, 2014
@jharding
Copy link
Contributor

I'm cleaning up the issues right now and since there are a couple of other issues (#62, #719) regarding default suggestions, I'm going to close this as a duplicate. Adding support for default suggestions is one of next items on my TODO list btw.

# for free to join this conversation on GitHub. Already have an account? # to comment
Development

No branches or pull requests

3 participants