• Resolved j893

    (@j893)


    In the tablepress “All Tables” view, the “ID” column is so narrow that if you use anything other than integers like “10” or “122”, you’ll likely have them wrap quite brutally (see below images). Could the CSS in “/plugins/tablepress/admin/css/common.min.css” be altered slightly from:

    50px, to 150px

    e.g. Changed to:
    .tablepress-all-tables thead .column-table_id {
    width: 150px;
    }

    Yikes!:
    50px wide

    Better:
    150px wide

    • This topic was modified 7 years, 8 months ago by j893.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    For this, I recommend to add this to your theme’s “functions.php” file or into a small new custom plugin:

    add_action( 'admin_print_styles', 'j893_tablepress_id_column_size', 20 );
    function j893_tablepress_id_column_size() {
    	$current_screen = get_current_screen();
    	if ( 'tablepress_list' === $current_screen->id ) {
    ?>
    <style type="text/css" media="screen">
    .tablepress-all-tables thead .column-table_id {
    	width: 150px;
    }
    </style>
    	<?php
    	}
    }
    

    Regards,
    Tobias

    Thread Starter j893

    (@j893)

    Thank you Tobias! Also an effective solution.

    And thank you for the best table plugin ever made for WordPress!

    Thread Starter j893

    (@j893)

    Just a note, modified it to this to avoid the deprecated admin_print_styles function:

    /* =============================================
           Alter TablePress Admin Layout Table.
       ============================================= */
    
    add_action( 'admin_enqueue_scripts', 'custom_tablepress_id_column_size', 20);
    
    function custom_tablepress_id_column_size() {
        $current_screen = get_current_screen();
        if ( 'tablepress_list' === $current_screen->id ) {
        ?>
        <style type="text/css" media="screen">
            .tablepress-all-tables thead .column-table_id {
                width : 150px !important;
            }
        </style>
        <?php
        }
    }
    • This reply was modified 7 years, 8 months ago by j893.
    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

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

    Oh, and good call! I had extracted this from an older note. Indeed, that admin_print_styles hook is now deprecated.

    Best wishes,
    Tobias

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

    Thread Starter j893

    (@j893)

    Rated ??

    • This reply was modified 7 years, 8 months ago by j893.
    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks! I really appreciate it!

    Best wishes,
    Tobias

    Thread Starter j893

    (@j893)

    BTW, I often use your plugin in concert with the awesome Print-o-Matic plugin. This gives me the perfect combination of table editing (TablePress), and the ability to print only the table (Print-o-Matic) — to PDF etc. in the browser.

    Just in case you might be interested to know what other plugins people use closely with yours…

    Example:
    https://applevalleygym.com/rates/

    • This reply was modified 7 years, 8 months ago by j893.
    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    very cool! This seems to keep more styling than what the PDF export/printing of the TablePress DataTables Buttons Extension can do.
    Thanks for sharing this!

    Best wishes,
    Tobias

    Thread Starter j893

    (@j893)

    The main advantage I usually find, is that having the browser generate the PDF seems more robust, as the PDF libraries for PHP are often not as reliable/up-to-date (which is obviously not your fault in any way, as those libraries are maintained by others, and the browser usually seems to know how to read it’s own rendering better—no matter how good the PDF library… though correct me if I’m mistaken on that…).

    But thanks for reminding me about the PDF export part of DataTables… I had used that in the past but had forgotten about that option!

    Yes, actually I put my custom table styles into the “custom CSS” field for Print-o-Matic, and then let the browser handle creating the PDF from the rendered page… That’s the best solution I’ve been able to come up with…

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    yeah, that’s definitely true!
    The DataTables Buttons add-on uses a JS library to generate the PDF, so it should see the browser output as well. But native features are even better, indeed.

    Best wishes,
    Tobias

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Request: Can the ID column be wider?’ is closed to new replies.