F
Filamentβ€’2mo 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
CodeWithDennisβ€’2mo ago
Do you mean like a filter in a relational table?
Mikail
Mikailβ€’2mo ago
yes
CodeWithDennis
CodeWithDennisβ€’2mo ago
You might be able to do it by accessing the livewire instance πŸ€” What are you trying to do exactly?
Mikail
Mikailβ€’2mo 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
CodeWithDennisβ€’2mo ago
It seems like you're making good progress. What's not working here? Im just a littlebit confused about this entire approach. πŸ˜…
Mikail
Mikailβ€’2mo ago
sorry there a bit of context. i used to get table filter data with $filters = $livewire->tableFilters; within table column.
CodeWithDennis
CodeWithDennisβ€’2mo 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
Mikailβ€’2mo ago
alright thanks
CodeWithDennis
CodeWithDennisβ€’5w ago
Did you figure it out?
Solution
Mikail
Mikailβ€’4w 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.
Want results from more Discord servers?
Add your server