Parent / Child Editor, Same Table

Parent / Child Editor, Same Table

arhynearhyne Posts: 2Questions: 1Answers: 0

I think I have a simple question.

I have read the documentation and have implemented the DataTable parent/child row detail.

https://datatables.net/examples/api/row_details.html

Parent:
"id": "1",
"name": "Tiger Nixon",
"position": "System Architect",
"salary": "$320,800",

Child:
"start_date": "2011/04/25",
"office": "Edinburgh",
"extn": "5421"

I'm attempting to do is add the Editor to this DataTable. I simply wish to allow the editor to operate on the entire table. The CSV export works, but only exports the Parent Table. So it is not loading the row information. The Editor Buttons throw some JS errors.

My first thought is that you must have two tables to implement the Parent/Child Editor.

Following this example

https://datatables.net/blog/2019-01-11

If this the case I can easily load the child table with a Join from a field in a parent table.

Perhaps I am missing something very simple?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,213Questions: 1Answers: 10,415 Site admin
    Answer ✓

    Is this something like what you want (except with export as well)?

    If your "details" information is just one:one (left join) with the parent row, then have the information shown in the child table as hidden columns (which is a bit like how the example in my link above works - although it does auto-column hiding using Responsive).

    The export buttons do not support the details rows at this time (which is why the information you want to export needs to be in the host table).

    Regards,
    Allan

  • arhynearhyne Posts: 2Questions: 1Answers: 0

    Thanks Allan. This is exactly what I was looking for, I'll look at the export functionality.

This discussion has been closed.