Hello,
Is there an option to change the default behavior that if _multi_ is set to _true_ the dropbox is closed once an option has been selected? Currently, if _multi_ is _true_ the dropbox remains open unless I click outside of the Select component.
Thanks
You can try setting autoBlur={true} property.
Thanks Ivan! That works like a charm ...
thank you i also struggled a bit
You can try setting
autoBlur={true}property.
You can try setting
autoBlur={true}property.
Hello,
I am using ant design . Is there an option to change that if multi is set to true the dropbox is need to be closed once an option has been selected Currently,
if multi is true the dropbox remains open unless I click outside of the Select component.
Here is my code:
const { Select, Radio } = antd;
const Option = Select.Option;
const children = [];
for (let i = 10; i < 36; i++) {
children.push(
function handleChange(value) {
//console.log(Selected: ${value});
}
function handleSelect(value) {
console.log(Selected Value: ${value});
}
class SelectSizesDemo extends React.Component {
state = {
size: 'default',
};
handleSizeChange = e => {
this.setState({ size: e.target.value });
};
render() {
const { size } = this.state;
return (
<br />
<Select
closeOnSelect={true}
autoBlur={true}
showArrow={true}
allowClear={true}
autoFocus={false}
mode="multiple"
size={size}
placeholder="Please select"
defaultValue={['a10', 'c12']}
onChange={handleChange}
onSelect={handleSelect}
style={{ width: '100%' }}
>
{children}
</Select>
<br />
</div>
);
}
}
ReactDOM.render(
closeOnSelect & autoBlur is not working correctly to close the dropdown after making selection.
Thanks
Venkat
Hello,
I am using ant design . Is there an option to change that if multi is set to true the dropbox is need to be closed once an option has been selected Currently,
if multi is true the dropbox remains open unless I click outside of the Select component.
closeOnSelect & autoBlur is not working correctly to close the dropdown after making selection.
Thanks
Venkat
autoBlur doesn't seem supported anymore, what's the way now?
There's a prop that you can pass to your dropdown - closeMenuOnSelect={true}. Although it is true by default, so on selection your dropdown should get close. Generally to avoid auto close we use closeMenuOnSelect={false}. Check if this works for you. eg-
Most helpful comment
You can try setting
autoBlur={true}property.