fix: use @push('js') to correctly inject tomselect script into Tablar layout

This commit is contained in:
2026-05-01 12:59:21 -04:00
parent 1f4b108c51
commit bb71e41459
+10 -17
View File
@@ -1,24 +1,17 @@
@push('js')
<script src="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/js/tom-select.complete.min.js"></script> <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"> <link href="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.bootstrap5.min.css" rel="stylesheet">
<script> <script>
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
console.log('DOM fully loaded, searching for selects...'); document.querySelectorAll('select').forEach((el) => {
const selects = document.querySelectorAll('select'); new TomSelect(el, {
console.log('Found ' + selects.length + ' select elements.'); create: false,
sortField: {
selects.forEach((el) => { field: 'text',
console.log('Attaching TomSelect to:', el); direction: 'asc'
try { }
new TomSelect(el, { });
create: false,
sortField: {
field: 'text',
direction: 'asc'
}
});
} catch (e) {
console.error('TomSelect failed for:', el, e);
}
}); });
}); });
</script> </script>
@endpush