Filtering does not work when using Filter::select() or Filter::multiSelect methods instead of Filter::inputText() method. #1834
Replies: 2 comments 2 replies
-
As far as I know, the only filter that currently works on a relationship column is inputText(). I changed my datasource to use a join instead and with that, you will be able to use any of the filters. |
Beta Was this translation helpful? Give feedback.
-
if you use select or multi select. Try to use builder instead relation. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, The following filters work with the Filter::inputText() method. However, they do not work with the Filter::multiSelect() or Filter::select() methods. What could be the problem? This is the code that should work. $filter =
Filter::multiSelect("licence_type_category_{$c->id}", 'id') ->dataSource($c->licence_types) ->optionLabel('name') ->optionValue('id') ->filterRelation('licence_types', 'id');
When you add this, it tries to find the column name to be filtered in the model named licence. It also needs to search for a relationship.
Example LicenceTable.php file above.
LicenceTable.txt
Beta Was this translation helpful? Give feedback.
All reactions