How to preserve id when sorting through a relation from another table? #2537
Unanswered
andrecuellar
asked this question in
Q&A
Replies: 1 comment
-
You need to include a select on your query to preserve the id. See the old demo for ref: https://datatables.yajrabox.com/eloquent/relationships Meo::select('meos.*') |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I have a datatable where I obtain certain columns from other tables, for example the column "customer" is obtained through a relation from another table
But when I press the sort by customer button, the IDs change to the ID of the table where the relation belongs
This generates errors in the buttons that I have on the right since these IDs do not exist in the "meos" table, only in the "locations" table that is in the relation
How can I make it sort while keeping the same ID it had?
I want to always keep as order criteria the ID of the table I am with, which is the "meos" table belonging to the "meo" class
This is my query
this is my function getcolumns
please, I need help.
Thanks :)
Beta Was this translation helpful? Give feedback.
All reactions