Dispatching events from filament blade components

Hey, how does one dispatch events from filament blade components, for example the button? This works fine:
<button wire:click="$dispatch('post-created')">ABC</button>
<button wire:click="$dispatch('post-created')">ABC</button>
And this does not:
<x-filament::button wire:click="$dispatch('post-created')">ABC</x-filament::button>
<x-filament::button wire:click="$dispatch('post-created')">ABC</x-filament::button>
2 Replies
cheesegrits
cheesegrits15mo ago
Where is the listener? Is it in Alpine in the Browser, or on a Livewire method?
Quadrubo
QuadruboOP15mo ago
The listener is in a livewire method:
#[On('post-created')]
public function updatePostList()
{
dd("why");
}
#[On('post-created')]
public function updatePostList()
{
dd("why");
}
A lot of other stuff is also pretty weird: For example triggering an alert is working on all key presses:
<input type="text" @keyup="alert('test')">
<input type="text" @keyup="alert('test')">
And dispatching an event works on Enter only:
<input type="text" @keyup="$dispatch('post-created')">
<input type="text" @keyup="$dispatch('post-created')">
Want results from more Discord servers?
Add your server