© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•13mo ago•
1 reply
Adnan Yalahow

watchout when afterStateUpdated from another component

i have this code
Forms\Components\Checkbox::make('Check All')
                    ->columnSpan('full')
                    ->live()
                    ->reactive()
                    ->afterStateUpdated(function (Forms\Get $get, Forms\Set $set, $state) {
                        $paymentDetails = $get('payment_details');
                        if ($state) {
                            if (is_array($paymentDetails)) {
                                foreach ($paymentDetails as &$detail) {
                                    if (isset($detail['is_checked'])) {
                                        $detail['is_checked'] = true; // Set the checked_value to true
                                    }
                                }
                            }
                        }else  {
                            if (is_array($paymentDetails)) {
                                foreach ($paymentDetails as &$detail) {
                                    if (isset($detail['is_checked'])) {
                                        $detail['is_checked'] = false; // Set the checked_value to true
                                    }
                                }
                            }
                        }
                        $set('payment_details', $paymentDetails);
                    }),
Forms\Components\Checkbox::make('Check All')
                    ->columnSpan('full')
                    ->live()
                    ->reactive()
                    ->afterStateUpdated(function (Forms\Get $get, Forms\Set $set, $state) {
                        $paymentDetails = $get('payment_details');
                        if ($state) {
                            if (is_array($paymentDetails)) {
                                foreach ($paymentDetails as &$detail) {
                                    if (isset($detail['is_checked'])) {
                                        $detail['is_checked'] = true; // Set the checked_value to true
                                    }
                                }
                            }
                        }else  {
                            if (is_array($paymentDetails)) {
                                foreach ($paymentDetails as &$detail) {
                                    if (isset($detail['is_checked'])) {
                                        $detail['is_checked'] = false; // Set the checked_value to true
                                    }
                                }
                            }
                        }
                        $set('payment_details', $paymentDetails);
                    }),

is_checked is checkBox component that is in a repeater so when using the above logic to make all true i want to trigger some logic but my afterStateUpdated function of is_cheked is not triggered how can i do this please Help me guys.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

call component from another component
FilamentFFilament / ❓┊help
2y ago
Dispatch event from afterStateUpdated to another field?
FilamentFFilament / ❓┊help
11mo ago
afterStateUpdated in custom component
FilamentFFilament / ❓┊help
3y ago
how to add css class to another component while afterstateupdated?
FilamentFFilament / ❓┊help
2y ago