EleventhTower
DateRangeFilter - Table doesn't update until I force refresh
I've been struggling with this for several days and am not getting past the issue. I have a filter that I execute that properly updates the header to the table with the indicateUsing method. However, the records in the table don't update until I actually refresh the page. How can I make it so that when I submit the filter the table records are re-queried based on my query modifications.
"""
->filters([
DateRangeFilter::make('date_range')
->label('Date Range')
->displayFormat('MM/DD/YYYY')
->format('m/d/Y')
->useRangeLabels(true)
->modifyQueryUsing(function (Builder $query, ?Carbon $startDate, ?Carbon $endDate) {
if (empty($startDate) || empty($endDate)) {
return $query;
}
return $query->withDateRange($startDate, $endDate);
})
->indicateUsing(function (array $data): ?string {
if (!$data['date_range']) {
return null;
}
return 'Date range: ' . $data['date_range'];
})
])
"""
I've tried using things like filtersApplyAction, I've passed in $livewire as a component, as well as HasTable. Tried doing things with refreshTable as well as getTableRecords()->fresh() etc. None of it is working.
Any help is appreciated.
1 replies