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

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    The table here will always stretch to the width that the content in the table requires, in this case, your images. Thus, we have to tell the images to shrink on smaller screen. For that, please try adding this CSS code to the “Custom CSS” textarea on the “Plugin Options” screen of TablePress:

    .tablepress-id-2 img {
      max-width: 100%;
    }

    Regards,
    Tobias

    Thread Starter TTP

    (@ttp)

    Thanks, but doesn’t work.

    Regards

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    ah, it looks like we’ll need one more line to make this work in Firefox as well (I had only tested in Chrome where the code from above worked right away). Please try again with

    .tablepress-id-2 img {
      max-width: 100%;
      width: 100%;
    }

    Regards,
    Tobias

    Thread Starter TTP

    (@ttp)

    Thanks, now it works.

    I did it a little bit different though, so it works on every page:

    .tablepress img {
    	height: auto;
    	margin: auto;
    	max-width: 100%;
    	width: 100%;
    }

    Is this possible with the table here?

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    setting the height and margin properties should not be necessary, but it also can’t hurt. So, good to hear that this is working ??

    Regarding the other table: That’s more tricky, as that one doesn’t have images that could shrink on small screens, and the text can not shrink directly, unfortunately. Also, the browser can’t add word-wrapping, as the cells mainly contain small one-word content. To make this table responsive, you would therefore have to use different approaches: You could either activate the “Horizontal Scrolling” checkbox for this table to make it scrollable on small screens, or you could take a look at the “flip and scroll” approach that the TablePress Extension from https://tablepress.org/extensions/responsive-tables/ adds to a table.
    Of course, if you have a specific behavior in mind that you want the table to have on small screens, we can also try to achieve that with some extra CSS (as long as the table retains its tabular structure, of course).

    Regards,
    Tobias

    Thread Starter TTP

    (@ttp)

    Everything works, thanks! One thing: Where can I find the (PHP?)files to translate the English remarks (i.e. “Show entries”, “Previous”, “Next”, “Search”, “Showing 1 to 10 of 2,537 entries”. See page.)?

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    nice! Great to hear that this worked! ??

    To translate those strings, you won’t need to edit PHP files. Instead, it should be enough to change the WP_LANG constant in your site’s wp-config.php to nl_NL. That would also change all the strings in the admin area to Dutch.

    Another option (which also helps if you want custom strings) would be to use this TablePress Extension: https://tablepress.org/extensions/change-datatables-strings/

    Best wishes,
    Tobias

    Thread Starter TTP

    (@ttp)

    I installed and activated the extension, uploaded a nl_NL.json file to the server in the “tablepress-change-datatables-strings” folder:

    {
    	"sProcessing":		"Bezig...",
    	"sLengthMenu":		"_MENU_ resultaten weergeven",
    	"sZeroRecords":		"Geen resultaten gevonden",
    	"sInfo":			"_START_ tot _END_ van _TOTAL_ resultaten",
    	"sInfoEmpty":		"Geen resultaten om weer te geven",
    	"sInfoFiltered":	"(gefilterd uit _MAX_ resultaten)",
    	"sInfoPostFix":		"",
    	"sSearch":			"Zoeken:",
    	"sEmptyTable":		"Geen resultaten aanwezig in de tabel",
    	"sInfoThousands":	".",
    	"sLoadingRecords":	"Een moment geduld aub - bezig met laden...",
    	"oPaginate": {
    		"sFirst":		"Eerste",
    		"sLast":		"Laatste",
    		"sNext":		"Volgende",
    		"sPrevious":	"Vorige"
    	}
    }

    but nothing happened. Then I deleted the lang-en_US.json file from the server, so there’s was only the Dutch file left, still only English was showing. Should I delete the lang-en_US.json file from the server and alter a line in the php file of the extension?:

    <?php
    /*
    Plugin Name: TablePress Extension: Change DataTables strings
    Plugin URI: https://tablepress.org/extensions/change-datatables-strings/
    Description: Custom Extension for TablePress to change strings in the DataTables JS library
    Version: 1.1
    Author: Tobias B?thge
    Author URI: https://tobias.baethge.com/
    */
    
    add_action( 'tablepress_datatables_language_file', 'tablepress_change_datatables_language_file', 10, 3 );
    
    function tablepress_change_datatables_language_file( $language_file, $datatables_locale, $path ) {
    	$changed_language_file = plugin_dir_path( __FILE__ ) . "lang-{$datatables_locale}.json";
    	if ( file_exists( $changed_language_file ) ) {
    		$language_file = $changed_language_file;
    	}
    	return $language_file;
    }
    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    did you upload and activate the PHP file (also inside the folder) as a WordPress plugin? Then, did you set the WP_LANG constant to nl_NL in your wp-config.php?

    Regards,
    Tobias

    Thread Starter TTP

    (@ttp)

    Yes.

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    ok. One more check: Is your JSON file named “nl_NL.json” or “lang-nl_NL.json”? It should be the latter.

    If that still does not work, please extend the used Shortcode to

    [table id=1 datatables_locale="nl_NL" /]

    Regards,
    Tobias

    Thread Starter TTP

    (@ttp)

    It is not possibe to change the shortcode of the table

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    ok, I was a little bit unclear here. Please change the Shortcode in the page where you have embedded the table.

    Regards,
    Tobias

    Thread Starter TTP

    (@ttp)

    The table is still visible but all the pagination is gone.

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    ok, it looks like you have edited the “lang-nl_NL.json” file in Word or WordPad, right? Due to that, there are now meta information in the file that break the format.
    You will need to save the JSON file again in “plain text” format.

    Alternatively, as TablePress already ships with a default “lang-nl_NL.json” file (in the i18n/datatables/ folder), you can simply use that.

    Regards,
    Tobias

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘adjustable width of table’ is closed to new replies.