Problems with an action.

Hi, I made a component with filament table, and i'm trying to add a custom action.
protected function getTableActions(): array
{
return [
Action::make('Promote to baseline')
->form([
TextInput::make('name')->required()
])
->action(function ($record, $data) {
app(VisualTestsServiceInterface::class)->promoteToBaseline($record, $data->name);
})
->icon('heroicon-o-cloud-upload')
->requiresConfirmation(),
];
}
protected function getTableActions(): array
{
return [
Action::make('Promote to baseline')
->form([
TextInput::make('name')->required()
])
->action(function ($record, $data) {
app(VisualTestsServiceInterface::class)->promoteToBaseline($record, $data->name);
})
->icon('heroicon-o-cloud-upload')
->requiresConfirmation(),
];
}
The problem is when I click the button, it don't shows the modal with the form, and it doesn't do anything.
11 Replies
Patrick Boivin
Can you share your Blade view?
jals65
jals65OP2y ago
<div> {{ $this->table }} </div>
jals65
jals65OP2y ago
jals65
jals65OP2y ago
As you can see the action is printed ok, but when i click it doesn't do anything No logs, no debug steps I don't know what it's happening
Patrick Boivin
I'm not sure if this applies to a table but can you try:
<div>
{{ $this->table }}

{{ $this->modal }}
</div>
<div>
{{ $this->table }}

{{ $this->modal }}
</div>
jals65
jals65OP2y ago
No, that doesn't works.
Patrick Boivin
Mkay... just noticed your action name Promote to baseline Try this
Action::make('promote_to_baseline')
->label('Promote to baseline')
// ...
Action::make('promote_to_baseline')
->label('Promote to baseline')
// ...
jals65
jals65OP2y ago
No, it fails. I'm going to debug in vendor files to see what is happening. I notice you if I find something.
Erik
Erik2y ago
Are you using unique id? Because it causes the same problem for me. I have changed it to "normal" auto incremental id and it started to work...
toeknee
toeknee2y ago
Is your action also extending table actions?
Rama
Rama13mo ago
I believe Is tour gettablequery, try retrun allá record as a test
Want results from more Discord servers?
Add your server