-
Notifications
You must be signed in to change notification settings - Fork 54
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
mapping config in async typeahead doesn't work with overrideOptions #99
Comments
donalmurtagh
changed the title
use async typeahead to set multiple schema fields
async typeahead ignores mapping config
Sep 27, 2018
donalmurtagh
changed the title
async typeahead ignores mapping config
mapping config in async typeahead doesn't work with overrideOptions
Sep 27, 2018
Any solution ? |
overrideOptions true is not working :( |
as @HaiderImran shows, after setting this option to Otherwise this is what I used to reproduce:
Skipping index.html file here for brevity. |
I've created a separate issue for that crash @HaiderImran #137 async typeahead crashes when typing after overrideOptions is set to true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using the async typeahead with an API that returns data such as
If I use the following config.
The
id
property value should be stored in the model, but it isn't (thetext
value is). Similarly, if I setmapping
to a function, the return value of the function should be stored, but it isn't.if
overrideOptions: true
is removed, the mapping works as expected.The fundamental problem is that if
overrideOptions
is true, we ignore anymapping
config and store the text typed by the user in the model. This implicitly assumes that theAsyncTypeaheadField
field is bound to aString
property of the schema, but I discovered this issue when binding it to anObject
property.Proposed Solution
Extend
overrideOptions
so the user can supply a function instead of just a boolean. If a function is supplied, it will be called with the text typed by the user as an argument. This would allowAsyncTypeaheadField
to be bound to any type of schema property, and any transformations to be applied to the text entered by the user.@sneu012 @mavarazy If you support this proposal, I can submit a PR?
The text was updated successfully, but these errors were encountered: