diff --git a/drcr/static/js/combobox.js b/drcr/static/js/combobox.js index 2a4573a..a21644c 100644 --- a/drcr/static/js/combobox.js +++ b/drcr/static/js/combobox.js @@ -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); diff --git a/drcr/templates/journal/journal_edit_transaction.html b/drcr/templates/journal/journal_edit_transaction.html index c37ac3d..c86f0e7 100644 --- a/drcr/templates/journal/journal_edit_transaction.html +++ b/drcr/templates/journal/journal_edit_transaction.html @@ -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) {