Open eele94 opened 4 months ago
I'm thinking of integrating actions for v3.
Hi, I was looking for a way to delete a record, is it currently possible? Or maybe through the edit modal?
@CharlieEtienne Yes, it's not super elegant, but you can do it in the edit modal like this:
use Filament\Forms\Components\Actions;
use Filament\Forms\Components\Actions\Action;
protected function getEditModalFormSchema(?int $recordId): array
{
return [
Actions::make([
Action::make('delete')
->icon('heroicon-m-x-mark')
->color('danger')
->requiresConfirmation()
->action(function () use ($recordId) {
static::$model::find($recordId)->delete();
$this->dispatch('close-modal', id: 'kanban--edit-record-modal');
}),
]),
];
}
Hopefully I'll create more elegant ways of doing this in v3.
Thanks, it's working. I just have one problem but I think it's not related: after I delete a record, the page loses scrollbar and I can't scroll up or down anymore. It's probably related to filament itself because I have the same problem with another plugin. EDIT: Found it
What happened?
Would be awesome to be able to add actions(e.g. tableactions) to the View
This way would be maybe doable to add comment functionality through a package like this https://github.com/parallax/filament-comments
I tried to make it working, but am failing to implement it in a clean way..
How to reproduce the bug
-
Package Version
2.6.1
PHP Version
8.3
Laravel Version
10.0
Which operating systems does with happen with?
No response
Which browsers does with happen with?
No response
Notes
No response