Customize Select in Relation Manager
Hi there!
I have a model with a Relation Manager, relating Product and Allergen models.
What I'm trying to do is show image and description of allergen in the Select component inside the AttachAction modal of the RelationManager. Something similar to this: https://v2.filamentphp.com/tricks/render-html-in-select-options
So, here is my code:
I've skipped linking it to a view until I could check it were working. Unfortunately, even when the
placeholder()
, searchable()
and multiple()
methods are working fine, it seems to be ignoring the getOptionLabelUsing()
method. I've tried also getOptionLabelsUsing()
(I can't tell the difference between both methos yet because I'm still a Filament newbie).
Is there something I'm doing wrong here? It is not the right way, maybe?Filament
Render HTML in select options by Matthew Ost - Tricks - Filament
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
Solution:
Jump to solution
It wasn't working either in a normal select. After a few tries, I've solved in a simpler way:
```
->headerActions([
Tables\Actions\AttachAction::make()...

3 Replies
This is how it renders

try it with normal action instead of using
AttachAction
, just for testing!
I think the AttachAction
overriding your getOptionLabelUsing
Solution
It wasn't working either in a normal select. After a few tries, I've solved in a simpler way:
I've added a getOptionHtml to retrieve the search result view:
