F
Filament5mo ago
Mikail

Accessing table filter

Anyone knows if it is possible to access table filter from infolist ?
Solution:
Yes, I did access livewire from the info list with $livewire = Livewire::current(). So I extracted data from table filters with $livewire->table filters['filter_name']. Thanks for the follow up....
Jump to solution
10 Replies
CodeWithDennis
CodeWithDennis5mo ago
Do you mean like a filter in a relational table?
Mikail
MikailOP5mo ago
yes
CodeWithDennis
CodeWithDennis5mo ago
You might be able to do it by accessing the livewire instance 🤔 What are you trying to do exactly?
Mikail
MikailOP5mo ago
InfoListSection::make('Academic Details') ->schema([ TextEntry::make('enrollmentSchoolSession.session_title') ->label('Session'), TextEntry::make('term_id') ->label('Term') ->getStateUsing(function (Livewire $livewire) { $livewire = $table->getLivewire(); $filters = $livewire->tableFilters; $filters = self::extractFilters($livewire); $term = Term::find($filters['term_id']); return $term ? $term->name : null; }), get filtered data from table to infolist
CodeWithDennis
CodeWithDennis5mo ago
It seems like you're making good progress. What's not working here? Im just a littlebit confused about this entire approach. 😅
Mikail
MikailOP5mo ago
sorry there a bit of context. i used to get table filter data with $filters = $livewire->tableFilters; within table column.
CodeWithDennis
CodeWithDennis5mo ago
You might want to start by getting the relational component first and see if you can access the filters on it. (I’m not sure, though.)
Mikail
MikailOP5mo ago
alright thanks
CodeWithDennis
CodeWithDennis5mo ago
Did you figure it out?
Solution
Mikail
Mikail5mo ago
Yes, I did access livewire from the info list with $livewire = Livewire::current(). So I extracted data from table filters with $livewire->table filters['filter_name']. Thanks for the follow up.

Did you find this page helpful?