Skip to content
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

Dropdown: Add public interface to get selected value #7692

Closed
peterremote1980 opened this issue Jan 17, 2019 · 4 comments
Closed

Dropdown: Add public interface to get selected value #7692

peterremote1980 opened this issue Jan 17, 2019 · 4 comments
Assignees
Milestone

Comments

@peterremote1980
Copy link

Hi
i can:

let gender: Dropdown = this.refs['gender'] as Dropdown

But the object gender has no property for the selected value, please help
thanks
Peter

@mikewheaton
Copy link
Contributor

Here's a CodePen that logs the reference each time the dropdown is changed: https://codepen.io/mikewheaton/pen/pqmLeK?editors=0010

I don't see a way to get the selected value directly from the reference object. Could you provide some more details on what you're building? You'll likely want to use the onChange prop to provide a function that updates the parent component's state, so that you can access the selected value.

@micahgodbolt
Copy link
Member

@mikewheaton this is a pretty low hanging fruit addition to dropdown's public interface. For any control that can be used uncontrolled, we should have have a public getter for the current value.

@mikewheaton mikewheaton changed the title how to get the selected value of a dropdown Dropdown: Add public interface to get selected value Jan 17, 2019
@mikewheaton mikewheaton assigned Jahnp and unassigned mikewheaton Feb 26, 2019
@joschect
Copy link
Contributor

Even though this isn't a huge change I think that we could batch it into #6030

@msft-fluent-ui-bot
Copy link
Collaborator

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@msft-fluent-ui-bot msft-fluent-ui-bot added the Resolution: Soft Close Soft closing inactive issues over a certain period label Apr 26, 2021
@microsoft microsoft locked as resolved and limited conversation to collaborators May 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants