TableWidget modal not opening

I have a tablewidget with the following code:
TextColumn::make('contents')
->label('Inhoud')
->icon('heroicon-s-cube')
->action(Action::make('contents')
->action(fn (Colli $record) => $record->advance())
->modalContent(fn (Colli $record): View => view('filament.fields.shipment-table-contents', ['record' => $record]))
)
->limit(50),
TextColumn::make('contents')
->label('Inhoud')
->icon('heroicon-s-cube')
->action(Action::make('contents')
->action(fn (Colli $record) => $record->advance())
->modalContent(fn (Colli $record): View => view('filament.fields.shipment-table-contents', ['record' => $record]))
)
->limit(50),
According to the following docs that should be good: https://filamentphp.com/docs/3.x/actions/modals#custom-modal-content. Only problem now is that no modal opens.
16 Replies
toeknee
toeknee6mo ago
There is no modal to open as there is no form or requiresConfirmation. Also you have two actions there, there should only be one.
Thijmen
Thijmen6mo ago
The second one is the action from the action. Not two different actions If i only define a form it still doesnt work?
toeknee
toeknee6mo ago
Why would a modal show without a form? and you can't have two action functions like that.
Thijmen
Thijmen6mo ago
Because it always does? Did you look at the docs? There is literally 2 actions there For a column action you need to do the first ->action() on the column In that function you make a Action with the action code inside Nothing weird here
Thijmen
Thijmen6mo ago
No description
toeknee
toeknee6mo ago
Yes they are sub elements.... You have put ->action()->action() the section action there is part of Action::
Thijmen
Thijmen6mo ago
No?
Thijmen
Thijmen6mo ago
No description
toeknee
toeknee6mo ago
I see now your code is badly formatted.
TextColumn::make('contents')
->label('Inhoud')
->icon('heroicon-s-cube')
->action(
Action::make('contents')
->action(fn (Colli $record) => $record->advance())
->modalContent(fn (Colli $record): View => view('filament.fields.shipment-table-contents', ['record' => $record]))
)
->limit(50),
TextColumn::make('contents')
->label('Inhoud')
->icon('heroicon-s-cube')
->action(
Action::make('contents')
->action(fn (Colli $record) => $record->advance())
->modalContent(fn (Colli $record): View => view('filament.fields.shipment-table-contents', ['record' => $record]))
)
->limit(50),
So if you want a modal, you need to add requiresConfirmation. Then the content will be what you have defined.
Thijmen
Thijmen6mo ago
Weird Still no modal
toeknee
toeknee6mo ago
What if you do ->form([TextInput::make('test')]) This is on the Action::make()
Thijmen
Thijmen6mo ago
If i do the following on a regular table:
TextColumn::make('reference')
->label('Eigen referentie')
->sortable()
->action(Action::make('contents')
->action(fn (Colli $record) => null)
->form([
Forms\Components\TextInput::make('contents')
->label('Inhoud')
->required()
->rules('required'),
])
)
TextColumn::make('reference')
->label('Eigen referentie')
->sortable()
->action(Action::make('contents')
->action(fn (Colli $record) => null)
->form([
Forms\Components\TextInput::make('contents')
->label('Inhoud')
->required()
->rules('required'),
])
)
It works On the tablewidget Exact same code Does nothing I get the feeling my tablewidget are not working correctly. ->visible() and ->hidden() were alsno not working the right way
toeknee
toeknee6mo ago
Very possibly, then I am unsure
Thijmen
Thijmen6mo ago
Not sure what could've caused this Its almost a standard repo Okay found the issue. It is due to the table query.