Closed David-Moreira closed 3 years ago
So having a custom filter method that Autocomplete would use?
I like both ideas :)
I'm looking for this feature as well. I'm looking for a solution to the use case where a user is asked to enter a vendor name into a component (eg: Autocomplete). As they type, the list of vendors is refined and suggestions provided.
If the typed vendor is ultimately not in the search dataset, the component will raise an event, or provide access to the text field so we can wire up the vendor creation process.
Correct me if I'm wrong but the Autcomplete component doesn't let me do this today, correct?
@adamkf No, this is not possible. Your idea to have an event when something is not found seems like a good solution.
Maybe Autocomplete should have a "NotFoundTemplate" RenderFragment with the text as context.
This way we could add some message or add a button or whatever we want.
So to summarize
Todo proposals:
I didn't even remember about opening this issue anymore 😅also #1890 could have some interesting features to further consider / augment autocomplete
@stsrki Cheers for the quick response mate, did not expect immediate attention (especially with the 0.9.3 release!)
ToDo looks good. I'd add that given TValue would likely be null in such a case, we should probably expose a property that returns the current value of the text field so we can interact either via the event, or plumb something up via a new text property.
NotFound event callback should provide the current text.
We already have SearchChanged
callback.
True, I'm still wrapping my head around how Blazor components pass info back and forth (still a bit new to me)
I copied the Autocomplete source and was able to get free typing working by just making the SelectedText a Parameter and adding a SelectedTextChanged event. I now just bind to SelectedText when I want free entry. I had to add calling the SelectedTextChanged event in a few places. Now the harder part is I would like to get standard validation (with annotations too) working on the SelectedText
Also would love to have this feature 🙂
@mtbayley I created a copy of the Autocomplete and added this functionality, can send it to you if you want it.
@WayneHiller you can also post it here :)
I noted the changes I made to the original files with // WH comments.
Is your feature request related to a problem? Please describe. I imagine a use case will be that autocomplete just augments the writing providing "suggestions". I think that it would be a nice to have, to be able to still freely type a value outside of the AutoComplete Data Values.
Another nice to have feature (Open another feature request if needed), is to have it display all available values on click with a scroll bar if there's alot of values. Then, if you type, it starts filtering the results.
Describe the solution you'd like Seems like a flag for both these features would be a nice to have.