TextColumn placeholder empty
Hi!
I've got an app I just upgraded from v2 to v3. I've got most of the kinks worked out, but one small thing is bugging me:
->placeholder
seems to not do much. Here's the column:
The cost_usd
attribute is a nullable float (π¬). formatStateUsing
here works fine, and the column in the resulting table looks correct...except if the value is null
. placeholder
doesn't seem to make a difference.
The table is in a custom widget and otherwise works great.
Am I missing something?9 Replies
Iβm not sure why the placeholder has no effect, but try this way:
Or this one:
Probably placeholder applies after
formatStateUsing
, since there always remains a dollar sign, so it cannot be considered empty and the placeholder does not displaySolution
I think this is a known bug and on the radar.
You know what's weird? I was using that exact ternary before the upgrade and it worked; now, though, the cell is still blank even if the short function returns a different string.
I'd thought the same thing re: the string format never truly being empty, but even just returning
$state
with the placeholder doesn't do the trick.
The money
method is cool, didn't know about it! Placeholder still blank though.
Ah that makes sense! Hadn't found any similar issues on github, must have just missed it. Let me know if I can help reproduce or debug!GitHub
placeholder() not working on Relationship / TextColumn::make('relat...
Package filament/filament Package Version v3.0-stable Laravel Version 10.10 Livewire Version No response PHP Version 8.2.7 Problem description TextColumn::make('relationship.column') ->p...
Try using
default
Thanks for the suggestion, I didn't know about
default
.
default
and placeholder
feel semantically different, though: default
provides a default value, which then gets passed to any formatters.
So, doing the following:
results in an exception, because money
requires a number, not a string -- but In progress
is a string.Placeholder meant for form fields like TextInput and SelectInput etc..
Yep I saw that in your issue -- maybe the docs just need to be updated?
Docs make it seem like
placeholder
can be used instead of the ternary I was using before, but I guess not.
Anywho -- thank you for your suggestion!You're welcome!