Fix broken custom comboboxes when adding postings to transaction

This commit is contained in:
RunasSudo 2024-04-06 18:56:06 +11:00
parent 9f72404aed
commit e19856ae7d
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 8 additions and 3 deletions

View File

@ -35,8 +35,7 @@ function updateComboboxInputs(elCombobox, elInput) {
});
}
// Init combobox
document.querySelectorAll('.combobox').forEach((elCombobox) => {
function initCombobox(elCombobox) {
const elInput = elCombobox.querySelector('input');
updateComboboxInputs(elCombobox, elInput);
@ -58,4 +57,7 @@ document.querySelectorAll('.combobox').forEach((elCombobox) => {
updateComboboxInputs(elCombobox, elInput);
});
});
});
}
// Init comboboxes
document.querySelectorAll('.combobox').forEach(initCombox);

View File

@ -217,6 +217,9 @@
let trNew = document.createElement('tr');
trNew.innerHTML = document.getElementById(sign === 'dr' ? 'template-dr' : 'template-cr').querySelector('tr').innerHTML;
trPosting.after(trNew);
// Initialise new combobox
initCombobox(trNew.querySelector('.combobox'));
}
function changeAmount(el) {