Answer the question
In order to leave comments, you need to log in
React. how not to close DropDown after menu click?
I'm using the airframe library, the UncontrolledDropdown component. After the action with the items (change the checkbox), the list closes, I can't make it stay open.
<UncontrolledDropdown className="ml-auto mt-1">
<DropdownToggle color="secondary">
<FontAwesomeIcon icon="bars" fixedWidth />
</DropdownToggle>
<DropdownMenu right positionFixed>
<DropdownItem name="simpleLine" id="simpleLine" onClick={this.handleChangeCheck}>
<CustomInput
type="checkbox"
name="simpleLine"
id="simpleLine"
defaultChecked={graphState.simpleLine}>
Статистика выполнения заказов
</CustomInput>
</DropdownItem>
<DropdownItem name="maket802" id="maket802" onClick={this.handleChangeCheck}>
<CustomInput
type="checkbox"
name="maket"
id="maket802"
defaultChecked={graphState.maket}>
802 Макет
</CustomInput>
</DropdownItem>
</DropdownMenu>
</UncontrolledDropdown>
handleChangeCheck(event) {
event.preventDefault();
let graphState = this.state.graphState;
const name = event.currentTarget.name;
if (name === 'simpleLine') graphState.simpleLine = !graphState.simpleLine;
if (name === 'maket') graphState.maket802 = !graphState.maket;
this.props.onChangeGraphState(event, graphState);
event.stopPropagation();
}
handleChangeGraphState(event, newState) {
event.preventDefault();
localStorage.setItem('graph', JSON.stringify(newState));
this.setState({ graph: newState });
event.stopPropagation();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question