Which datatable is it ?
wire:click is not responding in dataTable
I have having user component in Livewire.
In the blade file, it contains dataTable if I want to change the user status, like wire:click="changeStatus('{{ $user->id}}')" the is is Uuid, this method is not responding.
public function changeStatus($id) { dd($id); }
Nothing happening!
https://codervent.com/syndron/demo/vertical/assets/plugins/datatable/css/dataTables.bootstrap5.min.css https://codervent.com/syndron/demo/vertical/assets/plugins/datatable/js/jquery.dataTables.min.js https://codervent.com/syndron/demo/vertical/assets/plugins/datatable/js/dataTables.bootstrap5.min.js
@codingwithrk It's also possible that there are some conflicts between Livewire and the JS code for the datatable.
Why don't you code your own datatable with Livewire ? It's very simple to do.
It's difficult to fix your problem without seeing some code. My first guess is you're either...
- Not initiating Livewire correctly
- Not containing your component in one root html tag
But this is just a guess... literally a guess...
@codingwithrk Please share some pieces of code here.
@codingwithrk You could improve this part of the code, but it's doesn't concern your problem.
@if($value->status == 1)
<button type="button" class="btn btn-outline-success btn-sm" wire:click="changeStatus('{{ $value->id }}')">
<i class="bx bx-check-circle me-0"></i>
</button>
@elseif($value->status == 0)
<button type="button" class="btn btn-outline-danger btn-sm" wire:click="changeStatus('{{ $value->id }}')">
<i class="bx bx-x-circle me-0"></i>
</button>
@endif
<button type="button" class="btn btn-outline-danger btn-sm" wire:click="changeStatus('{{ $value->id }}')">
<i @class([
'bx me-0',
'bx-x-circle' => $value->status == 0,
'bx-check-circle' => $value->status == 1
])></i>
</button>
@codingwithrk Please show the code for the <head> tags.
@vincent15000 Shared in same git repo please check
@codingwithrk Are you using Livewire v2 ou v3 ?
With Livewire v3, you don't have to specify @livewireStyles inside the <head> tags. Same remark for AlpineJS : with Livewire v3, AlpineJS is directly included with Livewire, so you don't need to declare it in the app.js file, and you must not declare it, otherwise you will have conflicts.
@codingwithrk You should have a look at the installation guide.
Livewire will automatically inject livewire css and livewire.js and alpine.js
You should remove any references to these from your code.
Please or to participate in this conversation.