F
Filamentβ€’7mo ago
Silverhand

Show using modals, but edit and delete using a normal page

Hi guys, I'm new in Filament. I have a filament resource that I want to display with different behavior, so on detail/show it's using modal but on edit and create using a page. How do I do that without removing the edit and create route on the getPages()?
public static function getPages(): array
{
return [
'index' => Pages\ListApplicants::route('/'),
'edit' => Pages\EditApplicant::route('/{record}/edit'),
'create' => Pages\CreateApplicant::route('/create'),
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListApplicants::route('/'),
'edit' => Pages\EditApplicant::route('/{record}/edit'),
'create' => Pages\CreateApplicant::route('/create'),
];
}
If I remove them, the modal works, but the form also using modal, I want to keep the modal on the show only but keep the form for creating and editing using page.
Solution:
@Vp OMG, it's simpler than I thought. This is all we need:...
No description
Jump to solution
14 Replies
Vp
Vpβ€’7mo ago
Just pass ViewAction in $table, since you don't have a view page, it'll display as modal
Silverhand
SilverhandOPβ€’7mo ago
I did, I put it on the ->actions([]), is there anything wrong from this?
public static function table(Table $table): Table
{
return $table
->columns([
...
])
->actions([
Tables\Actions\ViewAction::make(), Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
ChangeApplicantStatusAction::make(),
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
...
])
->actions([
Tables\Actions\ViewAction::make(), Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
ChangeApplicantStatusAction::make(),
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
Vp
Vpβ€’7mo ago
So, if you click "view" what happens using like this?
Silverhand
SilverhandOPβ€’7mo ago
It's visit an edit page, I already defined the infolists that only works if I delete edit and create routes
Vp
Vpβ€’7mo ago
Are you sure? I just check and it's working fine tho
Vp
Vpβ€’7mo ago
If I click the rows then it's pointing to "Edit" as well, but "view" display the modal
Silverhand
SilverhandOPβ€’7mo ago
Could you show me how you wrote the table(), please?
Vp
Vpβ€’7mo ago
exactly like this
Silverhand
SilverhandOPβ€’7mo ago
Yeah it works if I click the view icon, is it possible to make it works when I clicking the row?
Vp
Vpβ€’7mo ago
instead of route you make to open modal (this part I don't know) 🀣
Silverhand
SilverhandOPβ€’7mo ago
πŸ˜†πŸ˜† Thanks for your assist man, I appreciate it!
Solution
Silverhand
Silverhandβ€’7mo ago
@Vp OMG, it's simpler than I thought. This is all we need:
No description
Vp
Vpβ€’7mo ago
Great, will keep this in mind as well
Want results from more Discord servers?
Add your server