F
Filamentβ€’6mo ago
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); I tried it via component, but it didn't work. $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); }, ],
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server