Replies: 5 comments 7 replies
-
Hmm, I don't have any experience with Livewire but it seems like they could work together.. just not with the livewire reload. What would work is to load JSON data from a Livewire backend. See these examples https://tom-select.js.org/examples/remote/ |
Beta Was this translation helpful? Give feedback.
-
So I've got this working with Livewire - just wrap the whole thing in a div and wire:ignore that div.
I am still working on how to hook into the item add event to update the server and retrieve the correct ID. So if anyone got that far, please share =) |
Beta Was this translation helpful? Give feedback.
-
@mikebronner It is impossible for me to get the code with "tom select" I copy you an example with "tail select" but they work exactly the same, the same logic should work Blade Component with AlpineJSselect.blade.php
Implementation
|
Beta Was this translation helpful? Give feedback.
-
you can reload the tom select object after livewire finish the process document.addEventListener('DOMContentLoaded', () => {
Livewire.hook('message.processed', (message, component) => {
let selects = el.querySelectorAll(component.el)
if (selects.length != 0) {
selects.forEach((select) => {
select.tomselect = undefined
new Tselect(select)
})
}
})
}) |
Beta Was this translation helpful? Give feedback.
-
Anyone can suggest how to use tom select because in livewire it is not loading when I am trying to hit event after livewire call in that when I add tom select script it throw me Tom-select already initialized error please help me !! |
Beta Was this translation helpful? Give feedback.
-
Hi! Has anyone managed to get it to work with livewire and its wire:model?
It starts fine but if you change an element of the selector it stops working due to the livewire reload. I would need a method to refresh it
Thx!
Beta Was this translation helpful? Give feedback.
All reactions