我想在bootstrap-select中使用addResults
选项添加新项目。我应该被提示添加搜索字符串,但我收到默认消息No Results
。
component.jsx
class TodoApp extends React.Component {
constructor(props) {
super(props);
}
componentDidMount() {
$(this.selectPicker).selectpicker({
liveSearch: true,
addResults: true,
});
}
render() {
return (
<div>
<select className="form-control" data-width="100%" ref={el => (this.selectPicker = el)}>
<optgroup label="Group 1">
<option defaultValue>Team</option>
<option value="1">AAA</option>
</optgroup>
<optgroup label="Group 2">
<option value="2">BAC</option>
<option value="3">BAY</option>
</optgroup>
<optgroup label="Group 3">
<option value="4">DACA</option>
</optgroup>
</select>
</div>
)
}
}
ReactDOM.render(<TodoApp />, document.querySelector("#app"))