Okay
  Public Ticket #961276
Hide columns via url
Closed

Comments

  •  2
    fmelin started the conversation

    Hi, I would like to know if you can hide the columns via url ($ _GET) attached image as an example,

    Beforehand thank you very much.

  • [deleted] replied

    Hi fmelin,
    Thank you for your purchase.

    Unfortunately something like this is not possible with built-in functionalities. Columns can be hidden from table settings or with custom function but it is not possible to hide them via URL.

  •  2
    fmelin replied

    How could you hide with a custom function ?, you could indicate the source code and how to use it.

    Beforehand thank you very much.

  • [deleted] replied

    Hi fmelin,

    You can hide it with JavaScript like this:

    <script>
    jQuery( window ).load(function() {
    wpDataTables.table_1.api().columns(0).visible(false)
    });
    </script>

    Where columns(0) is first column in the table.

    Or with PHP like my colleague wrote you in your last ticket:

    In file functions.php add this code

    function test_func($jsDef, $columnHeader) {
        if ($jsDef->origHeader =="OrignalColumnName") {
            $jsDef->bVisible = false;
        }
        return $jsDef;
    }
    add_filter('wpdatatables_filter_column_js_definition','test_func',10,2);
    

    Where "Original ColumnName" is the name of your column that you want to hide.