-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(list-picker): add textField, valueField and selectedValue properties #6033
Conversation
textField and valueField - should be used with arrays of JSON objects textField - tells the listview which property should be used to display each item valueField - tells the listview, which property should be used to update the selectedValue selectedValue - is the property that will contain the selectedValue, if valueField is specified, then it will contain the value from that field, otherwise it will contain the whole selected item
Please sign CLA at http://www.nativescript.org/cla |
CLA signature found, happy contributing! |
An example of using the new properties: <ListPicker items="{{ items }}"
textField="name"
valueField="role"
selectedIndex="2"
selectedValue="{{ selectedItem }}">
</ListPicker> |
It's unclear how I've tried various ways:
Doesnt seem to do anything. Another thing. Binding the component via reactive forms will still bind just the index, and not the |
When is Angular coming next? |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
PR Checklist
What is the current behavior?
Currently if we pass and array of json objects to a listview, there is no simple way to make it display a specific field from each item.
Also, we can only get the selectedIndex, but there is no direct way to get the selected object, or even specify which property should be returned.
What is the new behavior?
Implements #1677
Adds new properties to the ListView component (
textField
andvalueField
- should be used with arrays of JSON objects):textField
- tells the listview which property should be used to display each itemvalueField
- tells the listview, which property should be used to update the selectedValueselectedValue
- is the property that will contain the selectedValue, ifvalueField
is specified, then it will contain the value from that property, otherwise it will contain the whole selected itemBreaking changes
No breaking changes.
Demo app
I've added a sample in apps -> list-picker -> list-picker-json-array