question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Select does not display the selected value

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ericsoderberghpcommented, Oct 20, 2020

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 have valueKey={{ key: "id", reduce: true }}. I believe it works as is expected. We added this reduce sub-property to disambiguate which way the value should be interpreted.

0reactions
antonio-lm-jrcommented, Oct 20, 2020

Nice @ericsoderberghp . Add reduce=true on valueKey property is the least impactful for my project.

Thank you very much!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found