change value of input element only when opening the edit
updates do not need to update them (not yet done for enum and checkbox)
This commit is contained in:
@ -286,15 +286,6 @@ function updateValue(component) {
|
|||||||
else if (type == "input") {
|
else if (type == "input") {
|
||||||
let row = elem.closest('div');
|
let row = elem.closest('div');
|
||||||
row.classList.remove('row-waiting-for-answer');
|
row.classList.remove('row-waiting-for-answer');
|
||||||
|
|
||||||
let oldValue = ('oldValue' in elem) ? elem.oldValue : elem.value;
|
|
||||||
if (component.value != elem.value && parseFloat(component.value) != parseFloat(elem.value) && component.value != oldValue) {
|
|
||||||
if (elem == document.activeElement || oldValue != elem.value) {
|
|
||||||
row.classList.add('row-waiting-for-answer');
|
|
||||||
} else {
|
|
||||||
elem.value = component.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elem.actualValue = component.value;
|
elem.actualValue = component.value;
|
||||||
resizeTextfield(elem);
|
resizeTextfield(elem);
|
||||||
} else if (type == "checkbox") {
|
} else if (type == "checkbox") {
|
||||||
|
@ -242,6 +242,10 @@ function createIconEdit (input_element) {
|
|||||||
hideInputElements();
|
hideInputElements();
|
||||||
if (is_hidden) {
|
if (is_hidden) {
|
||||||
input_element.classList.remove('input-element-hidden');
|
input_element.classList.remove('input-element-hidden');
|
||||||
|
if (input_element.inputChild) {
|
||||||
|
// update input value before edit
|
||||||
|
input_element.inputChild.value = input_element.inputChild.actualValue;
|
||||||
|
}
|
||||||
icon_edit.setAttribute('src', 'res/icon_edit_close.png');
|
icon_edit.setAttribute('src', 'res/icon_edit_close.png');
|
||||||
} else {
|
} else {
|
||||||
icon_edit.setAttribute('src', 'res/icon_edit.png');
|
icon_edit.setAttribute('src', 'res/icon_edit.png');
|
||||||
@ -327,6 +331,7 @@ function createInputText(component) {
|
|||||||
};
|
};
|
||||||
form.appendChild(input);
|
form.appendChild(input);
|
||||||
form.appendChild(createSubmitButton());
|
form.appendChild(createSubmitButton());
|
||||||
|
form.inputChild = input;
|
||||||
return form;
|
return form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user