1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

fix a bug with the checkbox control in widget edit menus

This commit is contained in:
Sonja Happ 2021-05-05 14:14:12 +02:00
parent 0ec419e0bc
commit ac2883969b

View file

@ -21,21 +21,19 @@ import { Form } from 'react-bootstrap';
class EditWidgetCheckboxControl extends React.Component {
constructor(props) {
super(props);
}
let parts = this.props.controlId.split('.');
let isCustomProperty = true;
if (parts.length ===1){
isCustomProperty = false;
}
static getDerivedStateFromProps(props, state) {
let parts = props.controlId.split('.');
let isChecked;
if (isCustomProperty){
isChecked = this.props.widget[parts[0]][parts[1]]
} else{
isChecked = this.props.widget[this.props.controlId]
if (parts.length ===1){
isChecked = props.widget[props.controlId]
} else {
isChecked = props.widget[parts[0]][parts[1]]
}
this.state = {
return {
isChecked
};
}