handleCheckboxChange = (id, checked) => {
const { data } = this.state;
_.map(data, e =>
_.filter(e.option, m => m[COMPONENT_ID] === id).map(n => {
const temp = n.isVisible;
n.isVisible = checked ? 'Y' : 'N'; // eslint-disable-line no-param-reassign
if (n.isVisible !== temp) {
this.setState({
isEnable: false
});
} else {
this.setState({
isEnable: true
});
}
return n;
})
);
this.setState({ data });
}
I 'm just trying to depand my button's visibility on isEnable state while i'm just checking the checkbox everytime it is calling to handleCheckboxChange method.so my req. is when i changed into the value of isVisible from Y to N or N to Y then only button visibility should enabled, if user just checked the checkbox and then simply unchecked then button visibility should be hidden
Aucun commentaire:
Enregistrer un commentaire