SelectFilter - can i provide my own value + label / remove the default option
SelectFilter always populates option without value and default label "All":
<option>All</option>
How can i provide my own value and label for it?
Or second option - remove it altogether?5 Replies
you can change the label
->placeholder('new label')
you can customize ->options()
you can use a custom Select on ->forms()
https://filamentphp.com/docs/3.x/tables/filters#custom-filter-formsWell, none them actually solves the value problem, right?
now:
<option>All</<option>
wish: <option value="0">All</option>
Some backgound.
I have hierarchical data (with parent IDs).
And would like to (default) show only items with parentID = 0.
If i use Filament Filter element, it has value null
(and label/placeholder All
which i can change) and it has no effect to the queried data (basically without filter).
So my inital thought was to give this "placeholder" my own value (like i would do in basic HTML). And it should be default filter for my data.
I also use this select element in form and it can not be null
.none of them?
It seems the custom Form for this is a goto for me for now.
I missed this
selectablePlaceholder()
part.
Thank you!
This would be amazing in the future that i could just pass(thru) this method from SelectFilter
to Select
element/object instead of building form for that same base element!
This work with me