print Data Table without using oTableTools initialization param

print Data Table without using oTableTools initialization param

readyleereadylee Posts: 6Questions: 0Answers: 0
edited May 2011 in TableTools
Hi,

I would like to make use of Table Tools print functionality for making a print view of my DataTables table(s), but I am using custom buttons already. In fact the only functionality that I need from the TableTools plugin: Print.

If (Allan) you would be so kind as to forward the Print.js that you mentioned in this thread...: http://datatables.net/forums/comments.php?DiscussionID=3726&page=1

...it would probably help me immediately, from what I've gathered.

Otherwise, if anyone can offer some guidance as to how I can simply render a Print view of my Data Table(s) via a button click event, it would be greatly appreciated. Again, rendering my buttons via [code] oTableTools : { "aButtons": [copy,print ... ] } [/code] won't really be helpful. I need to create my toolbar buttons differently, but I do need for one of them to render a Printable view of the table (once it's clicked).

By the way; DataTables is some kind of wonderful... I look forward to other applications (in other applications)!

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I'm not sure that Print.js would help in this case, since it has no integration with DataTables - i.e. it wouldn't combine the paging into a single list like TableTools does, or deal with the scrolling in DataTables.

    There are two options off the top of my head for this situation:

    1. Create the button using oTableTools as normal, but then move it using standard DOM / jQuery manipulation, to wherever you want it on the page.

    2. You could hook into the private methods in TableTools and activate the print functions whenever your event handlers need. Probably not to hard to do, but you'd need to fish around in the TableTools code a little (have a look at fnClick for the 'print' button definition.

    Allan
  • readyleereadylee Posts: 6Questions: 0Answers: 0
    Thanks Allan. I've attempted suggestion #1: my Data Tables now have print view functional/accessible; only problem is now the print button is dancing all over the page. But that bug probably won't survive this morning - not on my watch!
    Again, thank you very much for your (rapid) response...
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Heh - my guess is that it might be the why TableTools deals with classes (which I've changed in the development version as it's a but annoying). Look for the hover class replacing the normal class in firebug.

    Good to hear that does the job.

    Allan
This discussion has been closed.