Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filamentβ€’2y agoβ€’
1 reply
slamx_

Custom Listeners in v3

I want to create a dispatch inside a Form Field Action (like repeater::createItem), but how I can access the livewire instance like here in v2?
 $livewire->emit('newRepeaterItemID', $newUuid);
 $livewire->emit('newRepeaterItemID', $newUuid);


I tried it via component, but it didn't work.
$component->dispatch('newRepeaterItemID', $newUuid);
$component->dispatch('newRepeaterItemID', $newUuid);


Any Ideas how convert this v2 into v3? Maybe I'm on the wrong path πŸ™

Here is a v2 Code-Snippet:
$this->registerListeners([
            'repeater::createItem' => [
                function (Repeater $component, string $statePath): void {
                    if ($statePath !== $component->getStatePath()) {
                        return;
                    }

                    $newUuid = (string) Str::uuid();

                    $livewire = $component->getLivewire();
                    data_set($livewire, "{$statePath}.{$newUuid}", []);

                    $component->getChildComponentContainers()[$newUuid]->fill();

                    $component->collapsed(false, shouldMakeComponentCollapsible: false);

                    $livewire->emit('newRepeaterItemID', $newUuid);
                    $livewire->emit('newRepeaterItem', $statePath);
                },
            ],
$this->registerListeners([
            'repeater::createItem' => [
                function (Repeater $component, string $statePath): void {
                    if ($statePath !== $component->getStatePath()) {
                        return;
                    }

                    $newUuid = (string) Str::uuid();

                    $livewire = $component->getLivewire();
                    data_set($livewire, "{$statePath}.{$newUuid}", []);

                    $component->getChildComponentContainers()[$newUuid]->fill();

                    $component->collapsed(false, shouldMakeComponentCollapsible: false);

                    $livewire->emit('newRepeaterItemID', $newUuid);
                    $livewire->emit('newRepeaterItem', $statePath);
                },
            ],
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

Custom Layout in Filament V3
FilamentFFilament / β“β”Šhelp
2y ago
Custom Table footer in v3
FilamentFFilament / β“β”Šhelp
3y ago
problems in v3 custom panel auth
FilamentFFilament / β“β”Šhelp
3y ago
Table listeners
FilamentFFilament / β“β”Šhelp
3y ago