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:
parent
0ec419e0bc
commit
ac2883969b
1 changed files with 9 additions and 11 deletions
|
@ -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
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue