fix: #10329, select elements in sorted-list not showing proper values

This commit is contained in:
Julian Lam
2022-02-18 14:49:15 -05:00
parent 52836f3a7f
commit 1fa4134201

View File

@@ -92,9 +92,15 @@ define('settings/sorted-list', [
const editBtn = $('[data-sorted-list-uuid="' + itemUUID + '"] [data-type="edit"]');
editBtn.on('click', function () {
const form = $('[data-sorted-list-uuid="' + itemUUID + '"][data-sorted-list-object="' + key + '"]').clone(true).show();
const form = $('[data-sorted-list-uuid="' + itemUUID + '"][data-sorted-list-object="' + key + '"]');
const clone = form.clone(true).show();
const modal = bootbox.confirm(form, function (save) {
// .clone() doesn't preserve the state of `select` elements, fixing after the fact
clone.find('select').each((idx, el) => {
el.value = form.find(`select#${el.id}`).val();
});
const modal = bootbox.confirm(clone, function (save) {
if (save) {
const form = $('<form class="" data-sorted-list-uuid="' + itemUUID + '" data-sorted-list-object="' + key + '"></form>');
form.append(modal.find('form').children());