jQuery DataTable Print Detail

jQuery DataTable Print Detail

josivanljosivanl Posts: 10Questions: 2Answers: 1

I have a datatable with original data and details data, this detail data can be expanded according to the user's wishes, however I have a printing problem, when I use the datatable print function, only the original data is printed, the detail data do not show.

I wonder if it is possible or not to print details. If it is not possible how best to display a detail in the same table so it can be printed?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 1,293Questions: 16Answers: 260

    The detail display is generated on the fly from the rows data when the plus icon is clicked. One option is to add hidden columns to the table containing the detail data you want to export. For example if you have two detail rows and append them to the end of the table you could use this to hide them:

    columnDefs: [{ targets: [-1, -2], visible: false}]

    By default I believe the export buttons will export both visible and hidden columns.

    Kevin

  • josivanljosivanl Posts: 10Questions: 2Answers: 1

    Thanks for the answer, but what I really need is to print the detail in the way it presents itself, ie my detail is a table that contains a formatting of column sizes and spaces already defined.
    I did a lot of research and I could not understand how I can do a customization of the print button action so I can add the lines of detail along the original line.

    If you have any other suggestions for printing detail while maintaining formatting ??

  • josivanljosivanl Posts: 10Questions: 2Answers: 1
    Answer ✓

    I was able to solve my problem following this solution, where it indicates a way to do to always print the detail.

    https://datatables.net/forums/discussion/43133/how-to-print-child-rows#latest

    I simply copied and understood the whole process. Apparently you do not have to change anything.

    Hope it helps someone!

Sign In or Register to comment.