F
Filament11mo ago
Thijmen

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
toeknee11mo 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
ThijmenOP11mo 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
toeknee11mo ago
Why would a modal show without a form? and you can't have two action functions like that.
Thijmen
ThijmenOP11mo 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
ThijmenOP11mo ago
No description
toeknee
toeknee11mo ago
Yes they are sub elements.... You have put ->action()->action() the section action there is part of Action::
Thijmen
ThijmenOP11mo ago
No?
Thijmen
ThijmenOP11mo ago
No description
toeknee
toeknee11mo 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
ThijmenOP11mo ago
Weird Still no modal
toeknee
toeknee11mo ago
What if you do ->form([TextInput::make('test')]) This is on the Action::make()
Thijmen
ThijmenOP11mo 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
toeknee11mo ago
Very possibly, then I am unsure
Thijmen
ThijmenOP11mo ago
Not sure what could've caused this Its almost a standard repo Okay found the issue. It is due to the table query.
Want results from more Discord servers?
Add your server