Replies: 5 comments 4 replies
-
Same question :) How can we use sort with dot notation? |
Beta Was this translation helpful? Give feedback.
-
Just use an eloquent filter: https://orchid.software/en/docs/filters/#eloquent-filter
And then in your screen's query() method smth like:
|
Beta Was this translation helpful? Give feedback.
-
I have it working in my project to be able to sort and filter on relationship field but was some time ago. Try to use the id field of that relationship. I think that was the only thing to do.
In my case the URI looks like that: ?sort=partner_id What I also did, but that should not be required. Just for better performance, is to add the relationship to the query() method. |
Beta Was this translation helpful? Give feedback.
-
Hello! Still need a better solution to this problem. |
Beta Was this translation helpful? Give feedback.
-
I posted a working but not optimal solution here: #2234 (comment) |
Beta Was this translation helpful? Give feedback.
-
I have a list of musical instruments. Each instrument is related to a category (flutes, clarinets, trumpets,...), and the category has a sort field (flutes at the top, drums at the bottom).
I already can display the list of instruments together with their related category in a Table, but how do I make Orchid sort by the category's sort field when clicking on the header?
On the page https://orchid.software/en/docs/quickstart-sort-filter-table/ the manual says that "Note. In this way, you cannot sort related models.", which is not really helpful as it does not indicate whatsoever how the problem could be tackled.
The manual states on https://orchid.software/en/docs/filters/ that
http://example.com/demo?sort=content.ru.name
will lead to
$model->orderBy('content->ru->name', 'asc');
which seems to be exactly what I need - but how do I make the header of the category column sort this way?
Thanks in advance, Estigy
Beta Was this translation helpful? Give feedback.
All reactions