Migrate fully away from Jquery Stage 1

This commit is contained in:
johnnyq
2026-08-14 17:11:01 -04:00
parent dc6b191eed
commit 2354dd1511
9 changed files with 257 additions and 167 deletions

View File

@@ -21,14 +21,14 @@
// If the client selector is disabled, we must be on a client-specific page instead. Trigger the lists to update.
if (clientSelectDropdown.disabled) {
let client_id = $(clientSelectDropdown).find(':selected').val();
let client_id = clientSelectDropdown.value;
populateLists(client_id);
}
// Listener for client selection. Populate select lists when a client is selected
$(clientSelectDropdown).on('change', function (e) {
let client_id = $(this).find(':selected').val();
clientSelectDropdown.addEventListener('change', function () {
let client_id = this.value;
// Update the dependent dropdown lists
populateLists(client_id);
@@ -77,7 +77,7 @@
dropdown.innerHTML = '';
// A multi-select keeps showing its old selections until select2 is told the value changed
clearTomSelect(dropdown instanceof Element ? dropdown : $(dropdown)[0]);
clearTomSelect(dropdown);
if (placeholderLabel !== null) {
dropdown[dropdown.length] = new Option(placeholderLabel, placeholderValue);
@@ -89,7 +89,7 @@
// Redraws a select2 component after its options have been replaced
function refreshDropdown(dropdown) {
if (dropdown) {
refreshTomSelect(dropdown instanceof Element ? dropdown : $(dropdown)[0]);
refreshTomSelect(dropdown);
}
}