Some code reorganization

This commit is contained in:
jos 2016-05-23 20:52:00 +02:00
parent b67d683f1a
commit f7c9b7d9ff
1 changed files with 23 additions and 19 deletions

View File

@ -1264,8 +1264,17 @@ Node.prototype._updateDomValue = function () {
this.dom.checkbox.checked = this.value;
}
//If the node has an enum property and it is editable lets create the select element
else if (this.enum && this.editable.value) {
else {
// cleanup checkbox when displayed
if (this.dom.tdCheckbox) {
this.dom.tdCheckbox.parentNode.removeChild(this.dom.tdCheckbox);
delete this.dom.tdCheckbox;
delete this.dom.checkbox;
}
}
if (this.enum && this.editable.value) {
// create select box when this node has an enum object
if (!this.dom.select) {
this.dom.select = document.createElement('select');
this.id = this.field + "_" + new Date().getUTCMilliseconds();
@ -1298,7 +1307,6 @@ Node.prototype._updateDomValue = function () {
if(this.schema !== undefined && (
!this.schema.hasOwnProperty("oneOf") &&
!this.schema.hasOwnProperty("anyOf") &&
!this.schema.hasOwnProperty("anyOf") &&
!this.schema.hasOwnProperty("allOf"))
) {
this.valueFieldHTML = this.dom.tdValue.innerHTML;
@ -1310,12 +1318,8 @@ Node.prototype._updateDomValue = function () {
}
}
else {
// cleanup checkbox when displayed
if (this.dom.tdCheckbox) {
this.dom.tdCheckbox.parentNode.removeChild(this.dom.tdCheckbox);
delete this.dom.tdCheckbox;
delete this.dom.checkbox;
} else if (this.dom.tdSelect) {
// cleanup select box when displayed
if (this.dom.tdSelect) {
this.dom.tdSelect.parentNode.removeChild(this.dom.tdSelect);
delete this.dom.tdSelect;
delete this.dom.select;