Is there a way to add an extra child row to a parent row that already has a child datatable?

Is there a way to add an extra child row to a parent row that already has a child datatable?

dt_userdt_user Posts: 51Questions: 16Answers: 0

I already have a child datatable and that I need. I want to know if there is a way to insert or add a new child row to the parent row that already has a child datatable?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,269Questions: 26Answers: 4,765
    edited July 2019

    Are you asking for something like this?

    Parent DT
       -> Child DT level1
           -> Child DT level2
    

    Or something like this?

    Parent DT
       -> Child DT level1a
       -> Child DT level1b
    

    I've done the first before and don't see any reason why you couldn't make the second work. Its just a matter of setting up the HTML, etc when calling row.child( format(row.data()) ).show();.

    Datatables doesn't impose limitations with the row.child() API.

    Kevin

  • dt_userdt_user Posts: 51Questions: 16Answers: 0

    Ok great!! I want to implement your second example. I already have a child datatable so I would like to add or insert a child row either above or below the child datatable.
    I just need to have an example of how to add a child row on top of the child datatable.

  • kthorngrenkthorngren Posts: 20,269Questions: 26Answers: 4,765

    Maybe you can start us off with an example of what you have. I presume you are using a format type function to generate the HTML for the child Datatable. All you would need to do is add HTML to the generated string to insert what you want. Something like this format function plus the HTML for your Datatable.
    https://datatables.net/examples/api/row_details.html

    Kevin

  • dt_userdt_user Posts: 51Questions: 16Answers: 0

    Hi kevin, This is a link: http://live.datatables.net/jaziqiya/19/ to an example I botched up to be similar to what I am working on. I would like to know how to add another child datatable to each parent row that already has an existing child table. I want to implement your second example you gave on July 18.
    The second child datatable would get information from a different source than the first child datatable and the parent row.

  • kthorngrenkthorngren Posts: 20,269Questions: 26Answers: 4,765
    Answer ✓

    Maybe this will get you started:
    http://live.datatables.net/foyideva/1/edit

    Kevin

  • dt_userdt_user Posts: 51Questions: 16Answers: 0

    Thank you so much kevin.

This discussion has been closed.