Select does not display the selected value
See original GitHub issueI updated my packages today and noticed that my selects are not showing the selected value. I am using the valueKey
and labelKey
properties as shown in the examples, but to no avail.
I performed some tests and the problem occurs from the version v2.13.0.
Expected Behavior
Display the selected value
Actual Behavior
Not applicable
URL, screen shot, or Codepen exhibiting the issue
Here’s a Codesandbox template that serves as a nice starting point for demonstrating an issue: https://codesandbox.io/s/jovial-rgb-eszoe?file=/src/App.js
Steps to Reproduce
Not applicable
Your Environment
- Grommet version: 2.14.0
- Browser Name and version: Versão 84.0.4147.89 (Versão oficial) 64 bits
- Operating System and version (desktop or mobile): Windows 10
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
html select not show selected even after set selected
I can clearly see select="selected" into select OPTION having value US in firebug. But neither firefox or chrome shown US as selected. I...
Read more >First option in select dropdown appears selected when no ...
When a select dropdown value is bound to a component variable, and this variable doesn't match any of the options in the dropdown,...
Read more >How to get selected value in dropdown list using JavaScript
The value of the selected element can be found by using the value property on the selected element that defines the list. This...
Read more >Select not displaying - Material Design for Bootstrap
I'm having trouble getting the select to display in my form. <select class="mdb-select md-form"> <option value="" disabled selected>Choose your ...
Read more >Dropdown list is not showing selected value
Solved: Hello everyone, At the moment, I'm having trouble with a dropdown list not showing a selected value from a previous adaptive form....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Whether the value is an object or is a property of an object is controlled by
valueKey={{ reduce: true }}
. https://v2.grommet.io/select#valueKey If I change the code sandbox to havevalueKey={{ key: "id", reduce: true }}
. I believe it works as is expected. We added thisreduce
sub-property to disambiguate which way the value should be interpreted.Nice @ericsoderberghp . Add
reduce=true
onvalueKey
property is the least impactful for my project.Thank you very much!