Hi Spencer,
thanks for your question.
Instead of removing the buttons via CSS, the better way should be to not show them at all.
For that, a small change in the generated JS code of the DataTables TableTools Extension is necessary. Please open the file “tablepress-datatables-tabletools.php” of the Extension and change line 60 from
$tabletools_options = '{ "sSwfPath": "' . $swf_path . '", "aButtons": [ { "sExtends": "copy", "sButtonText": "" }, { "sExtends": "csv", "sButtonText": "" }, { "sExtends": "xls", "sButtonText": "" }, { "sExtends": "pdf", "sButtonText": "" }, { "sExtends": "print", "sButtonText": "" } ] }';
to
$tabletools_options = '{ "sSwfPath": "' . $swf_path . '", "aButtons": [ { "sExtends": "pdf", "sButtonText": "" }, { "sExtends": "print", "sButtonText": "" } ] }';
Regards,
Tobias
Thanks so much Tobias – worked perfectly!
Hi,
very nice! Thanks for the confirmation!
Best wishes,
Tobias
Tobias, can the buttons be moved below the table instead of above?
Hi,
yes, that should be possible. However, it requires a change in the JavaScript code of the Extension. Please see line 62 of the file tablepress-datatables-tabletools.php:
$command = "var {$table_name} = {$command}, {$tabletools_name} = new TableTools({$table_name}, {$tabletools_options}); $('#{$table_wrapper}').before({$tabletools_name}.dom.container);";
Please try changing that to
$command = "var {$table_name} = {$command}, {$tabletools_name} = new TableTools({$table_name}, {$tabletools_options}); $('#{$table_wrapper}').after({$tabletools_name}.dom.container);";
Regards,
Tobias
Tobias, thanks again for the help, worked like a charm
Hi,
great to hear that! Thanks for the confirmation!
Best wishes,
Tobias
P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!