debug: simplify tomselect for basic diagnostic

This commit is contained in:
2026-05-01 14:26:04 -04:00
parent 6e2c27a5a4
commit d79d2fbe3e
+9 -25
View File
@@ -1,32 +1,16 @@
@push('js')
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.bootstrap5.min.css" rel="stylesheet">
<style>
.ts-wrapper .ts-control, .ts-wrapper .ts-control input { background-color: #ffffff !important; border: 1px solid #ced4da !important; }
.ts-dropdown { background-color: #ffffff !important; }
</style>
<script src="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/js/tom-select.complete.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.bootstrap5.min.css" rel="stylesheet">
<script>
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll('select').forEach((el) => {
if (el.tomselect) return;
console.log('Initializing TomSelect on:', el.id, 'Options:', el.options.length);
window.addEventListener('load', function() {
console.log("TOMSELECT DEBUG: Page loaded, checking for selects...");
var selects = document.querySelectorAll('select');
console.log("TOMSELECT DEBUG: Found " + selects.length + " selects.");
selects.forEach(function(el) {
console.log("TOMSELECT DEBUG: Initializing", el.id, "Options:", el.options.length);
new TomSelect(el, {
copyClassesToDropdown: false,
dropdownParent: 'body',
controlInput: '<input>',
sortField: {
field: 'text',
direction: 'asc',
func: function(a, b) {
const numA = parseInt(a.text, 10);
const numB = parseInt(b.text, 10);
return numA - numB;
}
}
create: false,
sortField: { field: 'text', direction: 'asc' }
});
});
});
</script>
@endpush