Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

selected item in select #36

Open
ido-ran opened this issue Sep 24, 2016 · 2 comments
Open

selected item in select #36

ido-ran opened this issue Sep 24, 2016 · 2 comments

Comments

@ido-ran
Copy link

ido-ran commented Sep 24, 2016

I'm using Etch to build a plugin and I have a select. I've try to use "React style" of having <select value={this.state.myval} but it does not seem to work.

I've end up running the following line after etch.initialize(this):
this.refs.myselect.value = this.state.myval

Do you have a recommended way of selecting an item in a select.

@nathansobo
Copy link
Contributor

nathansobo commented Sep 25, 2016

I haven't actually tried to use a select myself yet. The virtual-dom library used by etch assigns properties to the DOM nodes based on the JSX attributes, so I'm surprised that assigning the value property manually gives you a different behavior. Basically, this should work. Can you fiddle with it a bit more and if it still doesn't I'll try adding a case to the test suite to figure out what's going on.

@lloiser
Copy link
Contributor

lloiser commented Sep 28, 2016

Looks like this is actually a problem in virtual-dom Matt-Esch/virtual-dom#115 & Matt-Esch/virtual-dom#195
My solution is to set the selected on the option like it is mentioned in both of them.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants