Fixed default value bug in dropdowns inside domain server settings

This commit is contained in:
seefo 2017-06-14 17:17:00 -07:00
parent 6c2134901e
commit 0fa172a4ef
2 changed files with 9 additions and 5 deletions

View file

@ -1362,6 +1362,7 @@
"label": "Server Type",
"type": "select",
"placeholder": "Audio Mixer",
"default": "Audio Mixer",
"can_set": true,
"options": [
{

View file

@ -1299,7 +1299,7 @@ function makeTableHiddenInputs(setting, initialValues, categoryValue) {
}
html += "</select>";
html += "<input type='hidden' class='table-dropdown form-control trigger-change' name='" + col.name + "' value='" + option.value + "'></td>";
html += "<input type='hidden' class='table-dropdown form-control trigger-change' name='" + col.name + "' value='" + defaultValue + "'></td>";
} else {
html +=
"<td " + (col.hidden ? "style='display: none;'" : "") + " class='" + Settings.DATA_COL_CLASS + "' " +
@ -1442,7 +1442,10 @@ function addTableRow(row) {
input.attr("name", newName)
} else {
if (isDropdown) {
$(element).children("select").attr("data-hidden-input", newName);
// default values for hidden inputs inside child selects gets cleared so we need to remind it
var selectElement = $(element).children("select");
selectElement.attr("data-hidden-input", newName);
$(element).children("input").val(selectElement.val());
}
input.attr("name", newName);
}