material-ui
material-ui copied to clipboard
[Select Field] Multiple prop not allowing users to select multiple options
Problem description
[Select Field] When multiple prop is set to true, menu closes when user selects an option. Menu should stay open for user to select multiple options like in the Multiple Selection Menu section:
http://www.material-ui.com/#/components/select-field
Link to minimal working code that reproduces the issue
menuItems(selectedValues) {
return this.props.menuOptions.map((menuOption) => (
<MenuItem
key={menuOption}
checked={selectedValues && this.state.selectedValues.includes(menuOption)}
value={menuOption}
primaryText={menuOption}
insetChildren={true}
/>
));
}
render() {
const {selectedValues} = this.state;
return (
<Paper>
<SelectField
multiple={true}
hintText = {this.props.hintText}
value={selectedValues}
onChange={this.handleChange}
>
{this.menuItems(selectedValues)}
</SelectField>
</Paper>
);
}
}
Versions
- Material-UI:
- React:
- Browser:
Closing. Was using outdated Material UI version. V. 0.18.7 supports multi-select