Here's my Codesandbox
Now I change the title when user select an item on selectList(antd component) using e.target.textContent.
is there any way that i can show all the values, now I'm only able to show one select list value.
I want something like this : value from first dropdown / value from second dropdown
<DropDown>
<DropDown.DropDownTitle>
This title will update after user selection // this should be updated when user select
</DropDown.DropDownTitle>
<DropDown.DropDownBody>
<Select
defaultValue="lucy"
style={{ width: 120 }}
onChange={handleChange}
>
<Option value="jack">another</Option>
<Option value="lucy">another 2</Option>
</Select>
<Select
defaultValue="lucy"
style={{ width: 120 }}
onChange={handleChange}
>
<Option value="jack">another 3</Option>
<Option value="lucy">another 4</Option>
</Select>
</DropDown.DropDownBody>
</DropDown>
I can see you're using antd, I believe it's better to use Select with multiple selection, it will set the values the way you want it.
here's their sandbox: https://codesandbox.io/s/cpive
Related
In my code, I want to make it a default selected value if there is only one.
As of now the code looks as follows:
<select
name="something"
value={this.props.parentProps.value}
<option value="" disabled selected>--Select--</option>
<option value="Other">Other</option>
</select>
The idea here is to have the only option selected, if there is only one.
I could copy them out to and array within the code if needed:
<select options={something}
What would you recommend?
Basically I want something like:
if(only one option)
Select(that one);
you can do something like this:
<select
name="something"
value={this.props.parentProps.value}
<option value="" disabled selected={options.length === 1}>--Select--</option>
<option value="Other">Other</option>
</select>
this options.length === 1 will return true or false that will trigger the selected
I am using reactstrap with React JS and trying to figure out how to bind the input dropdown list.
When the data is coming in, the optionID can be from any from 1 to 5. I would expect that
when I bring up the UI, the dropdown is always showing Select option and never the other.
I thought if I set the selected={this.state.optionID === Input.value} it would make it work.
Any help is appreciated. Thanks.
<Input type="select" name="select" id="statusDropDown"
value={this.state.optionID} selected={this.state.optionID === Input.value}
onChange={this.handleOptionChange}>
<option value={0}>Select</option>
<option value={1}>Option 1</option>
<option value={2}>Option 2</option>
<option value={3}>Option 3</option>
<option value={4}>Option 4</option>
<option value={5}>Option 5</option>
</Input>
Please find the working sample here. My suggestion is to use a functional component.
HTML:
<select ng-model="productList.name" ng-options="productItem.uuid as productItem.name for productItem in product.items">
</select>
Render :
<option value="prod_1">Product 1</option>
<option value="prod_2">Product 2</option>
When we select any option in drop down list i need to show label value like Product 1 or Product 2.
So we make at ng-model for productList.label.
but we get "prod_1" or "prod_2"
I have got simple select box which should be set as default to state Active(true) or Blocked (false).
Any ideas how to do it as simple as it is possible ?
<select class="form-control" ng-model="selectedUser.active" >
<option value="true">Active</option>
<option value="false">Blocked</option>
</select>
Solved by adding
<option ng-selected="selectedUser.active" value="true">Active</option>
<option ng-selected="!selectedUser.active" value="false">Blocked</option>
In my requirement Initially it will show only search button not drop-down. Now, I need to show select list option directly when user click on search button instead of clicking on drop-down list. So I can get options when I click on search button and I can select any of them and once selected one option need to show another drop-down. Here is my code
<a><button>search</button></a>
<select><option value="">A</option><option value="">B</option>
<option value="">C</option>
<option value="">D</option>
</select>
here is fiddle http://jsfiddle.net/8bhvhq62/3/.
You could use ng-disabled directive here which would enable and disable the dropdown
Markup
<a><button ng-click="enabled=true">search</button></a>
<select ng-model="test" ng-disabled="!enabled">
<option value="">A</option>
<option value="">B</option>
<option value="">C</option>
<option value="">D</option>
</select>
<select ng-model="test1" ng-disabled="!enabled">
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
<option value="">4</option>
<option value="">5</option>
</select>
Fiddle Here