Closed artemmolotov closed 3 years ago
Could you further explain what you mean with "Sort table by new relationship"? This is unclear to me. Thanks!
Sort
= Order by
I forgot to say that the problem is with server-side rendering
and "normal"
relationships. With the recent PR (#2871), when creating relationships through column options
, sorting works.
Hi @ArtemMolotov , currently I am running into the same problem you suggested above. Could you please provide a more clear solution to this problem? As I understand, modify the code like #2871 and set relationship though column options will solve the problem, is it right? If that is the case, how can I set relationship through column options? Thank you in advance.
P/s: Is "normal relationship" https://voyager.readme.io/docs/relationships?
Hi!
As I understand, modify the code like #2871 and set relationship though column options will solve the problem, is it right?
I do not remember exactly, but most likely you are right.
If that is the case, how can I set relationship through column options?
https://voyager.readme.io/v0.11/docs/relationships
Is "normal relationship" https://voyager.readme.io/docs/relationships?
Yes. Currently I wrote controller for all breads and overrode index
method with next code:
This works in Voyager v1.0, in v1.1 the code has been radically changed. BUT be careful, because at the beginning I had a bug - the data of the first table was replaced by the data of the second table if the column names were the same. It seems to me that I solved this problem.
You can set custom controller in BREAD Builder or "using custom HTTP controllers" (or change routes).
@anhvu-hcmiu, please check this solution if you have the time. Thank you!
@ArtemMolotov Thank you so much Artem, I have tried the leftJoin method you suggested and everything works just fine. However, this is still a bug in Voyager right? If we do not customize the index method, the sort won't work given the relationship which has been set?
@anhvu-hcmiu
However, this is still a bug in Voyager right? If we do not customize the index method, the sort won't work given the relationship which has been set?
Yes, this is a bug. You can use one controller for all breads (or 2+ controllers with your custom FixBreadRelationshipSort
trait).
Is there any news regarding this issue and voyager 1.4.2? Thank you.
@Stehos you can check this PR #5120
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Description:
Sorting by relationships, not work for me. Maybe it's because of my changes, but I think I saw the problem after installation too. Can you check if the sorting works for you?
We can see
getRelationships
method where I found next code:But in relationship details:
Steps To Reproduce: