DataTables row grouping on multiple attributes
DataTables row grouping on multiple attributes
Hello,
I have a table in the database with following structure:
ID Date Employer Ship Price
---------------------------------------------------------
1 21/10/2016 Ana Santa 100
2 21/10/2016 Ana Nina 200
3 21/10/2016 Maria Pinta 150
(This is somewhat simplified, I'm really using EmployerID and ShipID in the database as foreign keys)
I need to group rows using two of these elements: Date and Employer.
For example, whenever there is a row with same Date and Employer, it should be displayed as a single row.
Something like this:
Date Employer Ship Price
-----------------------------------------------------
21/10/2016 Ana Santa, Nina 300
21/10/2016 Maria Pinta 200
Or, maybe something like this:
Date Employer Ship Price
-----------------------------------------------------
21/10/2016 Ana
Santa 100
Nina 200
21/10/2016 Maria Pinta 150
I was thinking about using combination of Date and EmployerID as a hidden column
(created on the server-side and then hidden on the client)
but I'm not really sure what to do afterwards.
I'm also not really sure if using hidden column is the right approach so
any suggestions, examples or advices are welcome.
The main reason for doing something like this is usability and easier overview of the data,
but users still need to have possibility to click on
such combined row and open all grouped rows for editing.
I'm using DataTables v1.10.11 and jquery v1.12.3.