select
select copied to clipboard
How to passed data-* ?
On documentation, especially this section listed passing data-* attribute, but how to implemented it?
i'd try like this
...
state = {
value:""
}
...
// onchange event
handleChange(e) {
console.log(e);
}
...
<Select
onChange={this.handleChange.bind(this)}
style={{ opacity: 1 }}
value={this.state.value}
data-value_nil={"selected_1"}
>
{
data.map((item, i) =>
<Option key={i} value={item.nama}>{item.nama}</Option>
)
}
</Select>
...
but only show value only, :grimacing:
This appears to be working in the latest version.
Using this sandbox URL: https://stackblitz.com/edit/react-i1dlec?file=index.js
I see the following in the dom:
<div class="ant-select ant-select-single ant-select-show-arrow" data-value_nil="something_1" style="width: 120px;">
This appears to be working in the latest version.
Using this sandbox URL: https://stackblitz.com/edit/react-i1dlec?file=index.js
I see the following in the dom:
<div class="ant-select ant-select-single ant-select-show-arrow" data-value_nil="something_1" style="width: 120px;">
Thanks for your reply, but i need get "something_1" value for to setState, not value of each option
I can't understand what do you need?
data-*
props will be passed to the dom of select.