Check if table is filtered by a user

I would like to do some calculation in getTableContentFooter() if filters are applied. Is there a way to check if a table is filtered by a user?
12 Replies
Dan Harrin
Dan Harrin2y ago
the $records should be pre-filtered maybe you can try $this->tableFilters['filter_name'] to check the data of a filter
daerentis
daerentisOP2y ago
I just tried something like this, im still into it but I think that could work:
public function isFiltered()
{
if ($this->getTableFilterState('filterName')['value']) {
return true;
}
}
public function isFiltered()
{
if ($this->getTableFilterState('filterName')['value']) {
return true;
}
}
Thank you for the hint!
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dan Harrin
Dan Harrin2y ago
isFiltered() should be on the list page, not the resource
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
LeandroFerreira
Hi! What are you trying to do?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
LeandroFerreira
Would you like to get the filters in the create page?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
LeandroFerreira
you could do in the create action in the list page:
Actions\CreateAction::make()
->url(function () {
return YourResource::getUrl('create', [
'param1' => 'value1',
'param2' => 'value2'
]);
}),
Actions\CreateAction::make()
->url(function () {
return YourResource::getUrl('create', [
'param1' => 'value1',
'param2' => 'value2'
]);
}),
Regards the parameters, you could use $this->getTableFilters() or $this->getTableFiltersForm() to get the table filters and send it to the create page, I think
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Kenneth Sese
Kenneth Sese2y ago
Can you clarify please. What you are explaining here seems different from what you originally asked about. You had asked about doing a calculation in the footer. But now you’re mentioning creating a new record. Was your first problem solved?
Want results from more Discord servers?
Add your server