© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
Phone Myat

Interact with Event in custom livewire component with filament table


class AvailableRooms extends Component implements HasTable, HasForms
{
    use InteractsWithTable; 
    use InteractsWithForms;
    
    public $availableRoomID = [];

    #[On('availableRoom')]
    public function index($available_room_id){
       $this->availableRoomID = $available_room_id;
    }

    function table(Table $table): Table
    {   
        return $table
            ->query(Room::whereIn('id', $this->availableRoomID))
            ->columns([
                TextColumn::make('room_name'),
                TextColumn::make('room_type'),
            ]);
    }

    public function render()
    {   
        return view('livewire.available-rooms');
    }
}

class AvailableRooms extends Component implements HasTable, HasForms
{
    use InteractsWithTable; 
    use InteractsWithForms;
    
    public $availableRoomID = [];

    #[On('availableRoom')]
    public function index($available_room_id){
       $this->availableRoomID = $available_room_id;
    }

    function table(Table $table): Table
    {   
        return $table
            ->query(Room::whereIn('id', $this->availableRoomID))
            ->columns([
                TextColumn::make('room_name'),
                TextColumn::make('room_type'),
            ]);
    }

    public function render()
    {   
        return view('livewire.available-rooms');
    }
}

When I receive event from available room, i want to store it to $availableRoomID variable and use it to query table. However it run table function run first and then run funtion for event. So variable is wrong for table query. How can I make it work for dynamic query? Or Can I run event function first? Thanks for Reading.
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

Unable to interact with Filament Table on a custom Livewire Component
FilamentFFilament / ❓┊help
11mo ago
Filament table in Livewire component!
FilamentFFilament / ❓┊help
2y ago
Filament table in Modal - livewire component
FilamentFFilament / ❓┊help
2y ago
Using filament components in custom livewire component
FilamentFFilament / ❓┊help
3y ago