F
Filamentβ€’8mo ago
Tetracyclic

Stretch grid table row so that column actions sit at the bottom

When a table is displayed as a grid using contentGrid(), if the heights of each row box differs, the footer actions will stick to the bottom of the content, rather than sitting flush with the bottom of the box. The obvious solution is to set the inner div immediately .fi-ta-record that wraps the row to flex h-full items-stretch (default is flex items-center) Is there a better way to apply these classes, than just manually targeting .fi-panel-app .fi-dashboard-page .fi-ta-record > div with height: 100%; align-items: stretch? It doesn't appear to be possible to target this container with extraAttributes.
15 Replies
Tetracyclic
TetracyclicOPβ€’8mo ago
@Zep Fietje sorry for the @ spam, but based on your response to Lara Zeus in the other channel, I'd guess that targeting the Filament CSS selectors in this case would be the "official" solution? Is there a reason that the footer actions aren't locked to the bottom of the "row" box by default? when tables are displayed as a grid.
Tetracyclic
TetracyclicOPβ€’8mo ago
For reference, default behaviour:
No description
Tetracyclic
TetracyclicOPβ€’8mo ago
Fix
No description
Zep Fietje
Zep Fietjeβ€’8mo ago
Let me know if you think it's not related though πŸ™‚
Tetracyclic
TetracyclicOPβ€’8mo ago
In the case of using contentGrid, I think it would be fixed by this line: https://github.com/filamentphp/filament/blob/4ec3145bbc27c7a6f32738e362eef4ed6a2b72f5/packages/tables/resources/views/index.blade.php#L527 Being replaced with:
'flex items-center' => ! $contentGrid
'flex h-full items-stretch' => $contentGrid
'flex items-center' => ! $contentGrid
'flex h-full items-stretch' => $contentGrid
But that may just be a naive fix for the problem I'm encountering, and could have knock on effects I'm not anticipating. I'll test whether the behaviour is the same when a ->url() is set on the row. Yeah, my suggested fix wouldn't solve #11814, as the anchors still aren't stretched to full height and as they wrap each individual column, there's lots of dead space that isn't linked around them, rather than the whole record being a link when ->url() is set on the row.
Zep Fietje
Zep Fietjeβ€’8mo ago
Feel free to create a PR for the fix that resolves your issue though If it fixes tables with contentGrid that's great already Then I'll handle the original issue for regular tables πŸ™‚
Tetracyclic
TetracyclicOPβ€’8mo ago
Sure, will test it out properly and then open a PR when I get a chance
neil.keena
neil.keenaβ€’7mo ago
Any chance that PR has been submitted? I'm getting the same problem
Tetracyclic
TetracyclicOPβ€’6mo ago
Apologies, I never got around to it. Does the following fix work for you:
.fi-panel-app .fi-dashboard-page .fi-ta-record > div {
height: 100%; align-items: stretch
}
.fi-panel-app .fi-dashboard-page .fi-ta-record > div {
height: 100%; align-items: stretch
}
(You'll probably need to change the leading classes to target the table in question)
neil.keena
neil.keenaβ€’6mo ago
Tanks a lot! That worked for me
Zep Fietje
Zep Fietjeβ€’6mo ago
Please still consider creating a PR if this improves the core design πŸ™‚
Tetracyclic
TetracyclicOPβ€’6mo ago
@Zep Fietje I'll put a PR together now, but I've not had time to test it properly, it's only a small change
Tetracyclic
TetracyclicOPβ€’6mo ago
GitHub
Fix footer actions on content grid not aligning to the base of the ...
When a table is displayed as a grid using contentGrid(), if the heights of each row box differs, the footer actions will stick to the bottom of the content, rather than sitting flush with the botto...
Zep Fietje
Zep Fietjeβ€’6mo ago
Thanks, @Ross Bearman!

Did you find this page helpful?