Allow users to create new if not found
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
No. The library is amazing!
Thoroughly Describe the solution you'd like A clear and concise description of what you want to happen.
Im surprised I dont see this already in here as it's pretty standard for tags and the like. If the user types something that doesnt exit, I need there to be an option to "Add _____ as new tag" that would then submit a function with the value.
Please provide a few use cases for this feature
- Tags
- Product List
- Todos
- Infinite uses
Please Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
I can add a small + button NEXT to the list to create a new option, but that's not nearly as efficient in the workflow
Additional context Add any other context or screenshots about the feature request here.
Hello @noctivityinc,
Thanks for your suggestion!
I'll make sure I got you right. You're looking forward to customizing the no-results condition by adding actions. You can do that through the noResults configuration if that's the case. Please check it on this link and let me know if that's what you're looking for.
Have a nice day!
@TarekRaafat worked great, thanks!
@TarekRaafat I spoke too soon.
While it DOES work to let me trigger an event to create a new item, there doesnt appear to be a way for me to refresh the data attribute with an updated source so that the new item appears the next time the user searches the list.
For example, assume this flow:
- User starts to type something not in the list
- resultsLst see there are no results so a new element is added with a click even attached to create a new item based on what they typed.
- User clicks the new element and the event creates the new item in the backend.
- User decides to change their selection to something else
- User then goes back wanted to select the item they created in step 3 and they cant because that item was never added!
I COULD create a new dom element and add it to the list, but that doesnt change the selection event, which returns an object from the data, not the actual dom element selected. Since the new element isnt in the data I'm stuck.
What we need is something like
`autoComplete.append([{id: 123, name: 'New Item'}]) that would let us add something new to the list and then refresh the data.
Any thoughts?