forked from TFMM/silent-auction
fix: use @push('js') to correctly inject tomselect script into Tablar layout
This commit is contained in:
@@ -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>
|
||||
<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', () => {
|
||||
console.log('DOM fully loaded, searching for selects...');
|
||||
const selects = document.querySelectorAll('select');
|
||||
console.log('Found ' + selects.length + ' select elements.');
|
||||
|
||||
selects.forEach((el) => {
|
||||
console.log('Attaching TomSelect to:', el);
|
||||
try {
|
||||
new TomSelect(el, {
|
||||
create: false,
|
||||
sortField: {
|
||||
field: 'text',
|
||||
direction: 'asc'
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('TomSelect failed for:', el, e);
|
||||
}
|
||||
document.querySelectorAll('select').forEach((el) => {
|
||||
new TomSelect(el, {
|
||||
create: false,
|
||||
sortField: {
|
||||
field: 'text',
|
||||
direction: 'asc'
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user