etch icon indicating copy to clipboard operation
etch copied to clipboard

selected item in select

Open ido-ran opened this issue 9 years ago • 2 comments

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.

ido-ran avatar Sep 24 '16 19:09 ido-ran

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.

nathansobo avatar Sep 25 '16 01:09 nathansobo

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

lloiser avatar Sep 28 '16 18:09 lloiser