• Resolved Geoff_A

    (@geoff_a)


    Hi,

    I’m trying to make a product comparison table. The problem is that my products are listed in the columns, rather than rows. Is there any way to filter columns, like with the row filter extension? Using show_columns=”3,4″ isn’t ideal, since the column orders may change.

    Also, it seems show_columns isn’t working with my tables. Here is the shortcode I’m using:

    [table id=1 row_hover=false show_columns=”3,4″ /]

    Any help would be greatly appreciated.

    https://wordpress.org/plugins/tablepress/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Unfortunately, I’ll have to disappoint you here. So far, I only developed a Row Filter Extension, and due to time constraints don’t have plans to add a Column Filtering Extension. Sorry 🙁

    For that show_columns parameter: That works in the opposite way: It will only re-show columns that have been hidden before (either via Shortcode or on the “Edit” screen). It will however not hide the other columns automatically. So, you might want to try

    [table id=1 row_hover=false hide_columns="all" show_columns="3,4" /]

    Regards,
    Tobias

    Thread Starter Geoff_A

    (@geoff_a)

    Tobias,

    No worries. Thanks for the tip to hide columns. It worked great!

    Regards,
    Geoff

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! 🙂 Good to hear that this helped!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

    Hello Tobias.
    Thanks for your great plugin.
    I’m trying to filter columns using a command that I saw in another post.

    “aoColumnDefs”: [{“bSearchable”: false, “aTargets” [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}]

    The problem is that I want this command appears for all tables
    I, without having to add on the text box “Custom Commands” from the options on the table.
    In what file and how I can add this command to display default me in all tables?
    Excuse my poor English.
    Thanks again.
    Thanks again.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    The best way to add this to all tables should be with some PHP code that uses the available plugin filter hooks.
    For example, please try adding this to the “functions.php” file of your theme or a small new plugin file:

    add_filter( 'tablepress_datatables_parameters', 'jacessario_turn_off_ordering', 10, 4 );
    function jacessario_turn_off_ordering( $parameters, $table_id, $html_id, $js_options ) {
      $parameters['columnDefs'] = '"columnDefs": [{"orderable": false, "targets" [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}]';
      return $parameters;
    }

    Note that this requires that all of your tables have at least 11 columns! Otherwise, this will break the JavaScript functions for the tables.

    Regards,
    Tobias

    You’re a genius, thank you very much for your quick response.
    I changed my mind and chose to use the great plugin DataTables Column Filter.
    My question is: how can set by default that for all my tables show filters at the end of each table without adding the shortcode datatables_columnfilter = “true”
    Can I create some function to do this?
    Is there any way that filters columns, appear at the top of the table instead of the end?
    I hope not to be abusing your kindness
    Thank you very much for everything

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    sure, you are very welcome!

    Setting up the Column Filter Extension for all tables only requires a small change in the file tablepress-datatables-columnfilter/tablepress-datatables-columnfilter.php of the Extension. There, change line 42 to

    $default_atts['datatables_columnfilter'] = 'true';

    That will turn on the Extension for all tables automatically.

    I don’t think that the script supports appearing at the top however, as that would interfere with the sorting.

    Regards,
    Tobias

    That works perfect thanks!
    Is there any way that the filters of each column appears by default the name of the first row?
    In this way the user will know that they are filter columns.

    I think “Placeholder” is the right term

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    from what I remember, the cell content of that footer row will be used as that placeholder, i.e. just copy the contents of the header row into the footer row.

    Regards,
    Tobias

    Hello again!
    I wanted to consult you if there is any way to put a link on my page so that the client can export your table,
    thanx and greetings from Argentina!

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Yes, for this, you could take a look at the TablePress TableTools Extension from https://tablepress.org/extensions/datatables-tabletools/

    Regards,
    Tobias

    Excellent!!
    Thanks!!!

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! 🙂 Good to hear that this helped!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Column filtering’ is closed to new replies.