F
Filamentβ€’2y ago
mszabeh

Actions in footer (bottom of ViewRecord page)

Hello, who knows how to have actions in footer (bottom of page) (in ViewRecord)
18 Replies
Dennis Koch
Dennis Kochβ€’2y ago
You mean getFormActions() (on the page) like Save and Cancel?
mszabeh
mszabehOPβ€’2y ago
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.
Dennis Koch
Dennis Kochβ€’2y ago
Yes, that's: getFormActions()
mszabeh
mszabehOPβ€’2y ago
but , we don't have getFormActions() method in ViewRecord, we have just getActions() I checked source, getActions() appear in header
Dennis Koch
Dennis Kochβ€’2y ago
Did you try getFormActions()??
mszabeh
mszabehOPβ€’2y ago
yes, I try, but i cant see actions in page 😟
Dennis Koch
Dennis Kochβ€’2y ago
Share your code
Dan Harrin
Dan Harrinβ€’2y ago
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
Dennis Koch
Dennis Kochβ€’2y ago
Oh really? Shouldn't it have a Cancel action?
mszabeh
mszabehOPβ€’2y ago
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_peyment')
Dan Harrin
Dan Harrinβ€’2y ago
i dont think so, theres nothing to cancel only on modals
Dennis Koch
Dennis Kochβ€’2y ago
Cancel as in Go Back. Or is this only via navigation and breadcrumbs? I think I have rarely used View Pages πŸ˜…
Dan Harrin
Dan Harrinβ€’2y ago
yeah exactly already in 2 places anyway and it feels weird to "cancel" viewing something
mszabeh
mszabehOPβ€’2y ago
As you can see , the buttons are displayed at the top
Dan Harrin
Dan Harrinβ€’2y ago
.
mszabeh
mszabehOPβ€’2y ago
yes. I use custom view
Dan Harrin
Dan Harrinβ€’2y ago
you shouldnt have a problem then copy what we did for the edit page
mszabeh
mszabehOPβ€’2y ago
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()" />
Want results from more Discord servers?
Add your server