select icon indicating copy to clipboard operation
select copied to clipboard

How to passed data-* ?

Open consciousnessdev opened this issue 5 years ago • 3 comments

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:

consciousnessdev avatar Oct 18 '19 03:10 consciousnessdev

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;">

svpease avatar Nov 16 '20 20:11 svpease

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

consciousnessdev avatar Dec 09 '20 04:12 consciousnessdev

I can't understand what do you need?

data-* props will be passed to the dom of select.

kerm1it avatar Dec 09 '20 05:12 kerm1it