MedicOneSystems / livewire-datatables

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS
https://livewire-datatables.com/
MIT License
1.19k stars 259 forks source link

Editable Boolean #364

Open mgalante1 opened 2 years ago

mgalante1 commented 2 years ago

I have a Boolean column in my datatable showing a check mark or an 'x' based on the value in the database. I was wondering if there was a way to edit this so that if I were to click on either the check mark or x, then the value in the database would change.

When I add the editable() attribute, the column just shows a 1 or nothing at all and I have to manually type the value that I would like to change it to.

mgalante1 commented 2 years ago

Nevermind, I was able to accomplish this by using the boolean.blade.php file as a template on a callback function.

key60529 commented 1 year ago

Nevermind, I was able to accomplish this by using the boolean.blade.php file as a template on a callback function.

May I know the sample code to accomplish this ? Cuz I tried both the callback function and the view function but still cannot make it right :(