Hi Tony,
thanks for your question.
For this, I recommend to use the “DataTables TableTools Extension” for TablePress, which you can get at http://tablepress.org/extensions/datatables-tabletools/
This will add a “Print” button above your table, which will then allow to just print the table, without the other stuff on the page.
Regards,
Tobias
Thanks Tobias,
I have installed datatables-tabletools/. I am not sure what steps to take to get the print option to show? I presume “Initialisation code” has to be included, I am not sure how to do this. Please help with some more direction?
Regards,
Tony
Hi Tony,
ok, you’ve done the first step, i.e. installing and activating the Extension.
Now, please extend your table’s Shortcode on the page from
[table id=6 /]
to
[table id=6 datatables_tabletools=true /]
Additionally, please go to the “Edit” screen of table 6, and check the “Use DataTables” checkbox. That is required for the Extension to work. You will then initially also see the sorting, filtering, and pagination features activated, so just uncheck the checkboxes for these individual features (below the “Use DataTables” checkbox).
Regards,
Tobias
Thanks Tobias,
I have got the options displaying, it is just to limit the options to print only that I am not sure about.
Regards,
Tony
Hi Tony,
ah, ok.
For that, you’ll need to modify the source file, of the Extension. Please edit the file “tablepress-datatables-tabletools.php” like this:
Replace line 60
$tabletools_options = '{ "sSwfPath": "' . $swf_path . '", "aButtons": [ { "sExtends": "copy", "sButtonText": "" }, { "sExtends": "csv", "sButtonText": "" }, { "sExtends": "xls", "sButtonText": "" }, { "sExtends": "pdf", "sButtonText": "" }, { "sExtends": "print", "sButtonText": "" } ] }';
with
$tabletools_options = '{ "sSwfPath": "' . $swf_path . '", "aButtons": [ { "sExtends": "print", "sButtonText": "" } ] }';
After that, you’ll only have the “Print” button.
Regards,
Tobias
Hi Tobias,
I understand, many thanks. I am developing at this stage, hopefully can reward once I have buy-in.
All the best,
Tony
Hi Tony,
sure, no problem! You are very welcome!
Best wishes,
Tobias
P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!