How can I create a ToggleColumn to change status from the list page
I've tried with multiple solution to add a ToggleColumn to list page but didn't get a proper success for this.
Issues: Into the database side data is updating for the status column but in the list page toggle is not getting proper record and showing only active/inactive as a toggle.
Here is my code, is ther any problem or I'm missing something or else?
15 Replies
Try like this:
Yes, this is working but the major issue is that once we change status from active -> inactive. Into database its updating but to the listing page after refreshing it'll display active instead of inactive.
Can you record some video about what happen.. because I am very confused now..
Checkout the screenshots. As 2 records are with inactive (0) status but to the list page it still showing active (1) status.
Is it a
boolean
column in database? and did you make casts
in Model?Yes, I've done it already
what is filament version? it's weird that why it's not working tho
filament v3
Yeah, same thing also I'm checking that because in the all examples its working properly.
v3.*.*
the exact version.. run php artisan about
or composer show filament/filament
to view the versionLaravel: v11.3.1
PHP: v8.2.21
Filament: v3.2.108
New updates are available on
filament
and laravel
as well.. suggest you to update.. but still I don't think this will resolve this..
And now I am completely out of idea 🤣
Did you change something other than default (creating resource php artisan make:filament-resource Company --generate
) except the table column?Noop, No any changes.
can you create reproduction repo.. will check and if it's indeed the bug then we can submit issue on filament github
You can try from your end as well. Just an update is making a separate enum file with constant to define status active = 1, inactive = 0
separate enum file with constant to define status active = 1, inactive = 0You didn't mention this part before.. and you said you did like this.. ToggleColumn is similar as Toggle (Form) which interact a boolean value.