mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 10:17:40 +02:00
correctly use default values
This commit is contained in:
parent
3f751bb5ca
commit
1997cd27bd
1 changed files with 4 additions and 7 deletions
|
@ -321,22 +321,19 @@ function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults) {
|
||||||
}
|
}
|
||||||
var keys = Object.keys(updateKeyPair);
|
var keys = Object.keys(updateKeyPair);
|
||||||
keys.forEach(function (key) {
|
keys.forEach(function (key) {
|
||||||
delete parsedData[groupName][key];
|
|
||||||
if (updateKeyPair[key] !== null && updateKeyPair[key] !== "null") {
|
if (updateKeyPair[key] !== null && updateKeyPair[key] !== "null") {
|
||||||
if (updateKeyPair[key] instanceof Element) {
|
if (updateKeyPair[key] instanceof Element) {
|
||||||
if (updateKeyPair[key].type === "checkbox") {
|
if (updateKeyPair[key].type === "checkbox") {
|
||||||
if (updateKeyPair[key].checked !== defaults[key]) {
|
|
||||||
parsedData[groupName][key] = updateKeyPair[key].checked;
|
parsedData[groupName][key] = updateKeyPair[key].checked;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
var val = isNaN(updateKeyPair[key].value) ? updateKeyPair[key].value : parseInt(updateKeyPair[key].value);
|
var val = isNaN(updateKeyPair[key].value) ? updateKeyPair[key].value : parseInt(updateKeyPair[key].value);
|
||||||
if (val !== defaults[key]) {
|
|
||||||
parsedData[groupName][key] = val;
|
parsedData[groupName][key] = val;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
parsedData[groupName][key] = updateKeyPair[key];
|
parsedData[groupName][key] = updateKeyPair[key];
|
||||||
}
|
}
|
||||||
|
} else if (defaults[key] !== null && defaults[key] !== "null") {
|
||||||
|
parsedData[groupName][key] = defaults[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (Object.keys(parsedData[groupName]).length === 0) {
|
if (Object.keys(parsedData[groupName]).length === 0) {
|
||||||
|
|
Loading…
Reference in a new issue