F
Filamentβ€’2y ago
hgms

Help with getTableRecordClassesUsing

I'm trying to add some conditional classes to my table rows and for some reason I can't get it to work. The classes appear on the table row, and if I use the classes on other elements in the UI it does render properly (so tailwind is compiling it). I've tried a bunch of configurations from the protected method and ultimately stripped it down to as simple a setup as possible, but it does not render the orange border. Is there something I'm missing or doing wrong? Thank you.
protected function getTableRecordClassesUsing(): ?Closure
{
return fn (Model $record) => 'border-l-2 border-orange-600 dark:border-orange-300';
}
protected function getTableRecordClassesUsing(): ?Closure
{
return fn (Model $record) => 'border-l-2 border-orange-600 dark:border-orange-300';
}
17 Replies
Dennis Koch
Dennis Kochβ€’2y ago
Not sure you can have a background on <tr>?! Border
hgms
hgmsOPβ€’2y ago
That's what's in the docs πŸ™‚ Which happens to be what I was looking to do as well. Still, if that's the issue I'll have to come up with something else I guess.
Dennis Koch
Dennis Kochβ€’2y ago
I think it should work, as I did something similar already. You double checked that your TW classes are included? Can you check in the inspector?
hgms
hgmsOPβ€’2y ago
Yeah, I will double check but if I apply the dark:border-orange-300 to the surrounding div of the table in the developer console, it works. It's there but crossed out
Dennis Koch
Dennis Kochβ€’2y ago
Crossed out means another rule overwrites it, right? Can you share a screenshot?
hgms
hgmsOPβ€’2y ago
Agreed. I'll grab a screen shot
hgms
hgmsOPβ€’2y ago
border-l-2 is being applied though
Dennis Koch
Dennis Kochβ€’2y ago
Hm, weird. Which rule overrides border-color?
hgms
hgmsOPβ€’2y ago
the divide-gray-700
Dennis Koch
Dennis Kochβ€’2y ago
Use border-l-orange-600 then.
hgms
hgmsOPβ€’2y ago
I'll give it a shot
Dennis Koch
Dennis Kochβ€’2y ago
And maybe you need !border-l-orange-600
hgms
hgmsOPβ€’2y ago
Yep, that did the trick. Thank you! Had to use ! as well. I am def not a css guru, but I thought that local classes always took precedence over inherited.
Dennis Koch
Dennis Kochβ€’2y ago
Nope. Only specificity counts.
hgms
hgmsOPβ€’2y ago
Ah, that's good to know. Thanks a lot for the help.
Dennis Koch
Dennis Kochβ€’2y ago
There is no such thing as "local" or "inherited"
hgms
hgmsOPβ€’2y ago
Looks like I need to hit some NetNinja on youtube lol
Want results from more Discord servers?
Add your server