Data source with nested child.
Data source with nested child.

Hi may I ask if this table structure
is posible with datatable?
My data is ready. If this would be posible, can you give me some tips on how to do this?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I'd be very interested in this as well.
In terms of the data it is certainly possible with Data Tables: Simple parent - child relationship.
But I have no idea how to display it this way with Data Tables' client components.
Regarding the data:
You can simply use an Mjoin to retrieve them: https://editor.datatables.net/manual/php/mjoin#Mjoin-class
Or if it is "read-only" and it is more complex than a simple parent child relationship you can use your own proprietary SQL in a getFormatter to retrieve what you need.
Here is an example for this:
This returns the same data format as an MJoin. Why not use an MJoin then? It can't do multiple joins and no inner joins etc. and I don't need to update the data anyway.
This thread should help, it's asking the same thing.
That said, @gyrocode 's link might help.
Cheers,
Colin
@colin, this looks really difficult and complicated. So there is actually no real support for this on the front end side?
My thinking would be rather simple like this:
- it is pretty easy to retrieve all the child row data with an MJoin and the like
- Doing it that way you can easily render the child values in separate lines, but within one cell, not in multiple cells.
- The only thing that is missing are new grid lines after each child or - as in @iamgenesisivan 's example - different colors.
Can you think of a simple solution for this? In this example I would want a line after each child record looking like the Bootstrap 3 grid lines in the Data Table. And I would also want the newly separated cells to be "striped" and "bordered". I think this is achieved by applying classes "table table-striped table-bordered". Like the red lines I poorly drew here:

Sorry I don't like HTML and front end programming ... Hence I don't have the creativity to come up with a solution myself ... I always rely on the default functionality of Bootstrap 3 and Data Tables ...
This is my HTML:
Yep, it's not currently supported. As you say it's complicated - we would've added it if it was easy
Colin
Easier than I thought ...
This is the code for the example above with the red lines:
And here is my new "solution": Bootstrap 3 Table within a Data Table cell:
And the modified code. Not many changes actually:
It's the ordering and filtering that are the tricky bits - but yep, glad you got it going.
Colin