Get the titles of fields in indicators for filter with form (schema)
I have this code
a filter with a form (schema) and a custom query. Why can't I get the name directly in indicator from the form and have it appear in the indicators? Why should I make new queries just to get the names that are already chosen in the fields of the filter?
can I make a PR for that?
2 Replies
If you pass the Filter class to the
indicateUsing
method, you can access the form schema with getFormSchema
. From here you can get the individual Select components and their list of options via getOptions
. You can then get the option label/title by passing in the $data['state_id']
or $data['district_id']
.
Please see below:
This is a simple and crude example, but hopefully it gives you an idea. I did something similar but with a custom filter class instead.Thanks. Your solution is good but doesn't work for the select field with the relationship method because the options will now load until the user search for it
I manage to solve it using some alpine and livewire stuff
its bad technique from me but I didn't find better one
this is the code with some properties in the page
and this