• Resolved DarkSafka

    (@darksafka)


    Hi

    I have installed TablePress and the Responsive Tables extension plugins. I have created a table and added it to my site with the following shortcode: [table id=1 responsive=”collapse” /]

    My problem is that I would like the table to “fully collapse” after a specific breakpoint but haven’t found a way to do it. Now in smaller screens it is still showing more than one columns (while the rest are hidden and only visible after clicking the plus icon). It’s really silly in some tables that have four colums and on mobile screens it shows three and hides only one. I’d like to ALWAYS show only one column (the first one) and have all the others hidden in mobile screens (so you would have to click the plus icon to see the rest). Is this doable? Picture of the problem: https://imgur.com/FgD5NTn

    Other problem I have is that I would like the shortcode to always include the responsive=”collapse” -part because if the people updating the content on the site add a new table with the “Add table” -button (in wysiwyg editor) they certainly won’t understand that they should always manually edit the shortcode to include the responsive=”collapse” part. So is there anyway I could force the shortcode to always have the responsive=”collapse” part included automatically?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    I see what you mean, but unfortunately, I’m not aware of a solution for this ?? From everything that I know, the external JavaScript code for this (see https://datatables.net/extensions/responsive/ ) only has that mode where one column disappears after the other.

    To make the collapse mode the default setting for all tables (so that you don’t have to change the Shortcode parameter), you can change line 105 of the file tablepress-responsive-tables.php from

    $default_atts['responsive'] = '';
    

    to

    $default_atts['responsive'] = 'collapse';
    

    Regards,
    Tobias

    Thread Starter DarkSafka

    (@darksafka)

    Thanks for the fast response! I had a feeling that the first problem wasn’t going to be solved that easily (making tables responsive in a smart way isn’t really the easiest thing to do in the first place) but that $default_atts thingy seems to work nicely so thanks for the help.

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

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

    Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Is it possible to enable responsive table (collapse) after a certain breakpoint?’ is closed to new replies.