Accessing table filter
Anyone knows if it is possible to access table filter from infolist ?
Solution:Jump to 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....
10 Replies
Do you mean like a filter in a relational table?
yes
You might be able to do it by accessing the livewire instance π€
What are you trying to do exactly?
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 infolistIt seems like you're making good progress. What's not working here?
Im just a littlebit confused about this entire approach. π
sorry there a bit of context. i used to get table filter data with $filters = $livewire->tableFilters;
within table column.
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.)
alright thanks
Did you figure it out?
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.