Save on checkbox changed
This commit is contained in:
parent
5197f22f9b
commit
f719ce52a3
1 changed files with 8 additions and 1 deletions
|
@ -25,12 +25,19 @@ class PropertiesForm extends React.Component<Props> {
|
||||||
Object.keys(types).map((name) => {
|
Object.keys(types).map((name) => {
|
||||||
let type = types[name];
|
let type = types[name];
|
||||||
let inputType = '';
|
let inputType = '';
|
||||||
|
let onChange = this.bindValue.bind(this);
|
||||||
if (type === 'string') {
|
if (type === 'string') {
|
||||||
inputType = 'text';
|
inputType = 'text';
|
||||||
} else if (type === 'number') {
|
} else if (type === 'number') {
|
||||||
inputType = 'number';
|
inputType = 'number';
|
||||||
} else if (type === 'boolean') {
|
} else if (type === 'boolean') {
|
||||||
inputType = 'checkbox';
|
inputType = 'checkbox';
|
||||||
|
|
||||||
|
// Settings are saved onBlur, but checkbox does not fire it
|
||||||
|
onChange = (e) => {
|
||||||
|
this.bindValue(e);
|
||||||
|
this.props.onBlur();
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +47,7 @@ class PropertiesForm extends React.Component<Props> {
|
||||||
<input type={inputType} name={name}
|
<input type={inputType} name={name}
|
||||||
className='column-input'
|
className='column-input'
|
||||||
value={value[name] ? value[name] : ''}
|
value={value[name] ? value[name] : ''}
|
||||||
onChange={this.bindValue.bind(this)}
|
onChange={onChange}
|
||||||
onBlur={this.props.onBlur}
|
onBlur={this.props.onBlur}
|
||||||
checked={value[name]}
|
checked={value[name]}
|
||||||
/>
|
/>
|
||||||
|
|
Reference in a new issue