Actions in footer (bottom of ViewRecord page)
Hello,
who knows how to have actions in footer (bottom of page) (in ViewRecord)
18 Replies
You mean
getFormActions()
(on the page) like Save and Cancel?yes, but I want to add custom actions
I declare actions in getActions() method,
but actions appear in top of page. I need to show this actions in bottom of page.
Yes, that's:
getFormActions()
but , we don't have getFormActions() method in ViewRecord,
we have just getActions()
I checked source, getActions() appear in header
Did you try
getFormActions()
??yes, I try, but i cant see actions in page π
Share your code
i dont think the view page has form actions
because theres no actions on a form that is disabled
you can customize the view and add the actions in similar to edit-record.blade.php
Oh really? Shouldn't it have a Cancel action?
class ViewSefaresh extends ViewRecord
{
protected static string $resource = SefareshResource::class;
protected static string $view = 'filament.resources.sefaresh.view';
protected ?string $maxContentWidth = 'full';
protected function getActions(): array
{
return [
Actions\EditAction::make(),
Actions\Action::make('reviewing')
->icon('heroicon-o-clipboard-check')
// ->size('lg')
->hidden($this->record->status != 'reviewing')
->action(function () {
$record = $this->getRecord();
$this->record->status = 'waiting_peyment';
$this->record->save();
redirect(route('filament.resources.sefareshes.index'));
}),
Actions\Action::make('waiting_peymen
t')i dont think so, theres nothing to cancel
only on modals
Cancel as in Go Back. Or is this only via navigation and breadcrumbs? I think I have rarely used View Pages π
yeah exactly
already in 2 places anyway and it feels weird to "cancel" viewing something
As you can see , the buttons are displayed at the top
.
yes. I use custom view
you shouldnt have a problem then
copy what we did for the edit page
finally:
I add this code in viewrecord class:
protected function getHeading(): string
{
return '';
}
this hide default header
then I add this code in custom view:
<x-filament::form.actions
:actions="$this->getActions()"
/>