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