Is there a way to add table rows with html?

Is there a way to add table rows with html?

chboccachbocca Posts: 53Questions: 10Answers: 0

Here is demo of simple row add function. When you click the "Add Rows" button it uses row().data() to copy the data from each row and then uses the row.add(data) to add new rows. But any formatting from the copied rows, like background color, is lost. Is there a similarly simple way to copy rows with the html intact and then add rows back in with html? Something like row().html() and row.add(html)? Thanks in advance, as always. c

Replies

  • colincolin Posts: 12,957Questions: 0Answers: 2,207

    row.add() can also take a node, so you can clone the existing nodes in the table and pass that in. See your example updated here: http://live.datatables.net/cuqofuco/1/edit

    Colin

  • chboccachbocca Posts: 53Questions: 10Answers: 0

    Beautiful. Thank you Colin.

    Here's updated demo.

    Stay well!

    c

  • FrandollowFrandollow Posts: 3Questions: 0Answers: 0

    I would like to know more about how to add table rows with HTML. Thank you!

  • allanallan Posts: 54,914Questions: 1Answers: 8,608 Site admin

    What would you like to know that isn't shown in the demos / examples linked to above?

    Allan

Sign In or Register to comment.