-
-
Notifications
You must be signed in to change notification settings - Fork 104
Added possibility to add an item when no item is found #215
Conversation
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.
This is some great work @matijs-toonen! I've just got one change request but then it's ready to merge. This will make a lot of people very happy!
776f4e0
to
60ecfa8
Compare
@chrissainty Cindy found this PR, and wondered if this might indirectly address the need we were talking about on Twitter. To recap, we want users to be able to type text into the TypeAhead that does not exist in the list, and potentially use that. Currently we do have a way to get at that text, but if the TypeAhead loses focus, the text is cleared, which is a very bumpy UX and clearly not something you are currently trying to support. Any thoughts? |
Hey @kinetiq. Yes Cindy messaged me earlier and I pointed her at this PR. It was a very odd, but great, coincidence this popped up when it did. It seems to me like it would solve your issue. @matijs-toonen did some great work here. |
Thanks for this great feature @matijs-toonen! |
Well that case - thanks @matijs-toonen, what a wonderful coincidence. :) I really appreciate your contribution. Turns out it will solve a headache for my team. Chris, any idea when this will be available in nuget? |
@kinetiq I plan on getting this released today. |
Situation
I would like to have the possibility to add an item using the typeahead component without the need to submit a form with all its data. This would be useful in cases like a label which is nothing more than plain text.
Description
This PR will add a new parameter to the typeahead component called
AddItemOnEmptyResultMethod
,the parameter will change the
NotFoundTemplate
to be a selectable item just like the search results, this item will however use theNotFoundTemplate
as the Template instead of theResultTemplate
.Warning
This adds a context to the
NotFoundTemplate
and will therefore not work out of the box whenupdating
, this context is added to let the user create the template with the search input. The searchinput can then be used within the template for extra possibilities.The context is not necessary and can be removed if requested, but is quite useful to fil the template with a placeholder like
Add "SearchInput" as a new label