• Resolved spencemann

    (@spencemann)


    Hello Tobias,

    I’m wondering how I can configure the display of TablePress Tools to show only the Download as PDF and Print buttons?

    I have located the CSS to remove buttons from the display for a specific table ID, however I would like to remove these buttons from ALL tables displayed on a site.

    Here is the css code that removes the display from a specific table.

    .DTTT_container #ToolTables_tablepress-2_0 {
    display: none;
    }

    .DTTT_container #ToolTables_tablepress-2_1 {
    display: none;
    }

    .DTTT_container #ToolTables_tablepress-2_2 {
    display: none;
    }

    Thanks so much for your help!

    Spencer

    http://wordpress.org/extend/plugins/tablepress/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    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

    Thread Starter spencemann

    (@spencemann)

    Thanks so much Tobias – worked perfectly!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    very nice! Thanks for the confirmation!

    Best wishes,
    Tobias

    mvaughn88

    (@mvaughn88)

    Tobias, can the buttons be moved below the table instead of above?

    Plugin Author TobiasBg

    (@tobiasbg)

    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

    mvaughn88

    (@mvaughn88)

    Tobias, thanks again for the help, worked like a charm

    Plugin Author TobiasBg

    (@tobiasbg)

    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!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Remove download as CSV and other buttons from TablePress Tools display’ is closed to new replies.