Move Table Actions to the right

If using the content-grid for tables instead of traditional tables, how can I move the column actions to the right? I've tried "justify-end" as extraAttribute, but it didn't work. But I can see inside the HTML that there's a "justify-start". How can I change this?
protected function getTableActions(): array
{
return [
Tables\Actions\ViewAction::make('view')
->form([])
->label('Details')
->button()
->color('primary')
->icon('heroicon-o-eye')
->modalHeading('Test')
->modalContent(fn ($record) => view('filament.modals.view-incident', ['record' => $record]))
->extraAttributes(['class' => 'justify-end'])
];
}
protected function getTableActions(): array
{
return [
Tables\Actions\ViewAction::make('view')
->form([])
->label('Details')
->button()
->color('primary')
->icon('heroicon-o-eye')
->modalHeading('Test')
->modalContent(fn ($record) => view('filament.modals.view-incident', ['record' => $record]))
->extraAttributes(['class' => 'justify-end'])
];
}
16 Replies
Dan Harrin
Dan Harrin2y ago
please show a screenshot of what you're looking for
Prodex
ProdexOP2y ago
I want the details button on the right. justify-end would work, but in the code example above, it doesn't work like this.
Dennis Koch
Dennis Koch2y ago
!justify-end ?
Dan Harrin
Dan Harrin2y ago
oh, i dont think thats an option
Dennis Koch
Dennis Koch2y ago
Because it needs to overwrite the other one? Otherwise target the action via CSS
Dan Harrin
Dan Harrin2y ago
i dont think justify-end will work the class will be on the wrong element maybe ->extraAttributes(['class' => 'ml-auto']) would
Dennis Koch
Dennis Koch2y ago
Oh didn't see it was put on the action itself
Prodex
ProdexOP2y ago
ah yeah, ml-auto works. But just to be sure, there's no way to put any class on the element above, right?
Dan Harrin
Dan Harrin2y ago
only with css by targetting filament-tables-actions-container
Prodex
ProdexOP2y ago
Conditionally hiding cols for each record isn't possible, right? I've seen in another post, that $record isn't available. But it would be pretty nice to e.g. hide the end_date if it's the same like start_date in this view (see screenshot).
Dennis Koch
Dennis Koch2y ago
It would make sense in this context but not for tables. I guess that's why it's not possible currently
Dan Harrin
Dan Harrin2y ago
you can use extraAttributes() again and pass in the $record there i think there would still be complications particularly surrounding things like sortable and searchable columns
Prodex
ProdexOP2y ago
and then use display: none or how would you hide it then?
Dan Harrin
Dan Harrin2y ago
yeah, or the hidden class
Prodex
ProdexOP2y ago
I see, well in a "dream world" I could hide start_date and end_date and display another field just for the single date for this context. But as it's a table I see that it's not a good approach. How would you approach this? I think currently there's no other way for the admin panel to have something like this other than a table.
Dan Harrin
Dan Harrin2y ago
you can use getStateUsing() on the end_date and return null if its the same as the start_date
Want results from more Discord servers?
Add your server