0

I am using DataTables.net library but I don't like their print output (Instead, I would like to format my own printable table that looks different from the style of the data-table, but keep the data-table style as is for display non-print purposes).

One option that this library has is to export the data from the table to a JavaScript object, so we can get access to the data from the datable and do whatever we want.

So some options for my solution would be:

1) Create a separate HTML page with the table & css all prepared and do my printing via window.open() with query string parameters and then do window.print() on-load of that.

2) same as #1 but with a big hidden input field and do form post/request.

3) stay on same page, dynamically draw a table, hide everything I don't want to print, do window.print(), then remove from the dom the newly added table and re-show the non-printable stuff.

What do you guys think, is one of those a good solution, or is there a much better option? Note: The data-set is not massive, but could be as much as 30 rows and 10 columns.

Chris
  • 968
  • 16
  • 27

1 Answers1

0

Well nobody seems to have input on this yet but Ive decided to move forward using the form post method & hidden fields. A good example of this can be seen here:

posting to javascript and creating hidden field on the fly

that link points to an answer on somebody else's questionUpdate: To actually solve my issue I had to end up using window.opener so the below link is more about what I did i think than the above:

window opener solution

(that link points to an answer on somebody else's question)

Community
  • 1
  • 1
Chris
  • 968
  • 16
  • 27