Project first in results, subprojects after
Project first in results, subprojects after

Hey
My client is asking for this:
The search results display the "projects" first and the associated "subprojects" after.
So when you search for the projects name, the project eill show in results along eith the subprojects whicj will display below, on their own rows.
If you search for the subproject, the associated project will still show above, including the rest of the associated subprojects below.
And he do not wish to click on the projects row to then display the subprojects on the child row. All on their own row without clicking.
Do you have any link or can you point me somewhere where I can figure this out?
It seems a bit complex task to me.
Thanks ?
Jonas
Answers
Sorry for spelling mistakes, I'm typing on the phone.
This would be a likely starting-point:
https://datatables.net/examples/api/row_details.html
But I'm afraid the extra complications you require aren't catered for out-of-the-box.
Another option to look at is the RowGroup extension.
Kevin
Thanks guys, I made it work and it's rather simple.
Then order the results after the hidden columns with "project" and "subproject" texts.
And then
Or so I thought... The subprojects are still all displayed in the bottom, instead of below the associated project.
The rowGroups are being duplicated now. Screenshot -> https://ibb.co/X4H0jGw
This example works:
https://datatables.net/extensions/rowgroup/examples/initialisation/simple.html
Without actually seeing the table with the problem it would be hard to say what the problem is. Please post a link to your page or a test case replicating the issue.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
The rowGroup functionality alone is not quite what I need.
But I found another solution using Ransacker (with Rails).
Thanks for the help!
Sorry, I was being a noob.
It sorted the subprojects in the bottom, because I sorted the datatable after the column with "project" and "subproject".
The solution was to loop through the records with an index-number-column, and then sort the results after the index numbers.
It works perfect now!