Browse Source

Update radio property view setValue method

no-jquery
Artur Arseniev 9 years ago
parent
commit
2c54933f4e
  1. 20
      src/style_manager/view/PropertyRadioView.js

20
src/style_manager/view/PropertyRadioView.js

@ -41,15 +41,15 @@ module.exports = require('./PropertyView').extend({
}
}
},
/*
getInputValue() {
return this.$input ? this.$el.find('input:checked').val() : '';
const inputChk = this.getCheckedEl();
return inputChk ? inputChk.value : '';
},
*/
getInputValue() {
getCheckedEl() {
const input = this.getInputEl();
const inputIn = input ? input.querySelector('input:checked') : '';
return inputIn ? inputIn.value : '';
return input ? input.querySelector('input:checked') : '';
},
setValue(value) {
@ -57,7 +57,13 @@ module.exports = require('./PropertyView').extend({
let val = value || model.get('value') || model.getDefaultValue();
const input = this.getInputEl();
const inputIn = input ? input.querySelector(`[value="${val}"]`) : '';
inputIn && (inputIn.checked = true);
if (inputIn) {
inputIn.checked = true
} else {
const inputChk = this.getCheckedEl();
inputChk && (inputChk.checked = false);
}
},
});

Loading…
Cancel
Save