Datatables Editor with Child Rows

Datatables Editor with Child Rows

jbronikowskijbronikowski Posts: 7Questions: 4Answers: 0
edited September 2017 in Free community support

Has anyone ever used the child rows with the editor. If so, does anyone have any code

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

Replies

  • allanallan Posts: 63,460Questions: 1Answers: 10,466 Site admin

    It should basically be a case of merging the code from that example with that from the Editor example that you want to use. Have you tried that? If so, what did you come up with?

    Allan

  • dan@19ideas.comdan@19ideas.com Posts: 56Questions: 13Answers: 1

    I'm not sure I follow this, I would like the same thing as well. In the code for the child rows, you deliberately create a new table template dynamically in javascript, which you then inject. This is only readable.

    What if I need ways to edit or update the functionality? Would you suggest that I have to create textbox fields then? How would I save or update the values? I would prefer if I can open a popup of only the fields in the child row, as I would with the parent row.

    Also, is there a way where I wouldn't need to create table template in javascript? Can I just create an html file with handlebars (like angular), and just inject it from the file?

  • allanallan Posts: 63,460Questions: 1Answers: 10,466 Site admin

    Hi Dan,

    Is the inner table you want to modify part of the parent row's data (like in the child row example) or do you have a one-to-many relationship?

    For the former, there are two options:

    1. Just trigger editing on the parent row to show the standard Editor modal, or
    2. Use a standalone Editor inside the child row.

    If you are using a one-to-many relationship, you could use the approach detailed in this blog post just moving the child table into the child row, rather than in its own container.

    Allan

This discussion has been closed.