How to get infolist in ViewAction modal in table widget?

I've created a table widget and I'd like to get the infolist I defined in the resource for this specific model to show up when I view the record (which opens in a modal on both the resource and this table widget). I've tried adding the infolist method, but there nothing appearing inside the model. What am I missing?
class ConversationReports extends \Filament\Widgets\TableWidget
{
public function table(Table $table): Table
{
return $table
->query(ConversationReport::query())
->columns([
// ...
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make()
->url(fn (ConversationReport $record) => ConversationReportResource::getUrl('edit', ['record' => $record])),
])
->recordAction(Tables\Actions\ViewAction::class)
->recordUrl(null);
}

public static function infolist(Infolist $infolist): Infolist
{
return ConversationReportResource::infolist($infolist);
}
}
class ConversationReports extends \Filament\Widgets\TableWidget
{
public function table(Table $table): Table
{
return $table
->query(ConversationReport::query())
->columns([
// ...
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make()
->url(fn (ConversationReport $record) => ConversationReportResource::getUrl('edit', ['record' => $record])),
])
->recordAction(Tables\Actions\ViewAction::class)
->recordUrl(null);
}

public static function infolist(Infolist $infolist): Infolist
{
return ConversationReportResource::infolist($infolist);
}
}
Solution:
on the view access class you should be able to do:
->recordAction(Tables\Actions\ViewAction::make('view')->infolist([schema]))
->recordAction(Tables\Actions\ViewAction::make('view')->infolist([schema]))
...
Jump to solution
4 Replies
Alex
Alex3w ago
I don't see where you are customizing the modal content. It looks like you're using a stock ViewAction.
Arjen
ArjenOP3w ago
I am, I was hoping/expecting that Action to just work, but it seems it doens't hehe
Alex
Alex3w ago
If it where me, I'd start here https://filamentphp.com/docs/3.x/actions/modals#customizing-the-modals-heading-description-and-submit-action-label The documentation doesn't say if you can add an infolist. But if I were to try to add one, I'd start by returning a closure to the description method and see where that takes me. FYI I'm a newbe to Filament, but was so happy I got help, I'm trying to pay it forward.
Solution
toeknee
toeknee3w ago
on the view access class you should be able to do:
->recordAction(Tables\Actions\ViewAction::make('view')->infolist([schema]))
->recordAction(Tables\Actions\ViewAction::make('view')->infolist([schema]))

Did you find this page helpful?