sortable
sortable copied to clipboard
Can't get the plugin to work
Hey!
I tried both ways of installing the plugin (npm and CDN). The plugin script is included after the livewire scripts. I add the necessary attributes to the items, but nothing is happening at all. I don't get any error messages or anything.
The genrated HTML is like this
<tbody wire:sortable="updateUnitOrder">
<tr wire:sortable.item="1" wire:key="1">
<td>
1
</td>
<td wire:sortable.handle="" class="px-6 whitespace-nowrap py-3">
Testing
</td>
</tr>
<tr wire:sortable.item="2" wire:key="2">
<td>
2
</td>
<td wire:sortable.handle="" class="px-6 whitespace-nowrap py-3">
Testing 2
</td>
</tr>
<tr wire:sortable.item="3" wire:key="3">
<td>
3
</td>
<td wire:sortable.handle="" class="px-6 whitespace-nowrap py-3">
Testing 3
</td>
</tr>
</tbody>
I also tried using different elements (ul and li) but it is as if the script isn't even included (even though it is loaded) Any suggestions?
Simply to test, try adding the CDN version to your layout blade.
...and go form there! If the JS files are not in the correct order, you'll soon know from an error in console.