• Resolved bandit1730

    (@bandit1730)


    Hello Tobias.

    Is there a way to change multiple rows from “td” to “th” as it originally imported from HTML file?

    instead of having all this code (for just 13 rows on this example (12 + thead). I need 29 for this specific table):
    *********************************************************************
    .tablepress-id-nys thead th,
    .tablepress-id-nys tfoot th,
    .tablepress-id-nys a,
    .tablepress-id-nys .row-13 td,
    .tablepress-id-nys .row-38 td,
    .tablepress-id-nys .row-58 td,
    .tablepress-id-nys .row-80 td,
    .tablepress-id-nys .row-93 td,
    .tablepress-id-nys .row-109 td,
    .tablepress-id-nys .row-130 td,
    .tablepress-id-nys .row-155 td,
    .tablepress-id-nys .row-174 td,
    .tablepress-id-nys .row-196 td,
    .tablepress-id-nys .row-198 td,
    .tablepress-id-nys .row-204 td {
    background-color: #333;
    color: #FFFFFF;
    }

    .tablepress-id-nys .row-hover tr:hover td {
    background-color: #333;
    color: #FFFFFF;
    }
    ******************************************************************
    to something more efficient like:
    .tablepress-id-nys th,
    .tablepress-id-nys a,
    .tablepress-id-nys .row-hover tr:hover th {
    background-color: #333;
    color: #FFFFFF;}
    (don’t want the “hover” color the same as “th”)
    See page at:

    Note: Please see bottom of page for a duplicate “responsive table”. The layout doesn’t serve my purposes. Is there any fix for this?

    Thanks in advance,

    Joseph.

    https://www.ads-software.com/plugins/tablepress/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi Joseph,

    thanks for your post, and sorry for the trouble.

    No, sorry, something like that is not possible, as HTML tables can only have one header at the top of the table.

    Instead of having to write all this code manually, you could however take a look at the TablePress Row Highlighting Extension, which is described at https://www.ads-software.com/support/topic/highlight-a-row-based-on-value?replies=16
    Instead of filtering for “YES” as in that example, you could add a new (hidden) column to the table, where you add some keyword like “HEADER”. Then, you would use that for the highlighting and those rows would get a CSS class that you can target more easily in the “Custom CSS”.

    For that Reponsiveness problem: The layout shows what it’s expected to show. If it’s not really what you want, you could maybe take a look at horizontal scrolling only (without the flipping), as shown in https://www.ads-software.com/support/topic/responsive-tables-scroll-only?replies=6#post-5511954

    Regards,
    Tobias

    Thread Starter bandit1730

    (@bandit1730)

    Hello again.

    Done this:
    ********************************************************

    • installed premium plugin
    • modified short code
    • added CSS

    [table id=nys row_highlight=”header” /]

    .tablepress-id-nys .row-highlight-header td {
    background-color: #333 !important;
    }
    *******************************************************

    and cannot get it to work.
    https://123corporatetransportation.com/destinations/ny-car-service-to-jfk-lga-ewr-swf-airport-pickup-suv-van-bus-limo/

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ok, that’s good. Now you will just have to add the relevant data for the filtering, i.e. an extra column in the table (probably a new first column would be best) that you hide via the “Selected columns: Hide” button, and where you type the word “header” into the cell for those rows that you want to have appear as headers.

    Regards,
    Tobias

    Thread Starter bandit1730

    (@bandit1730)

    hello again.

    Yes, I did that (add/hide column) by adding a new column (when you add a column, if defaults to the last position). After your last reply, I tried to drag the column to the 1st position and I could not, therefore I deleted it and “inserted” a column in the 1st position and added the “header” text to desired rows.
    Well…. I have bad and good news. The bad news is that if I hide the column, it doesn’t work. The good news is that if the column is shown, it works as intended (so, I am back to square one).

    Could you add a function or develop a plugin to “select a row” and assign a class/id or change it from <td> to <th> even if it means losing the sorting feature?? It could be premium feature that I would be willing to contribute with a donation to get it going.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah, my bad, I forget to ask you to make a change in the Row Highlighting Extension’s PHP code. Please, in the file /tablepress-row-highlighting/tablepress-row-highlighting.php, change line 56 from

    add_filter( 'tablepress_table_render_data', array( __CLASS__, 'process_parameters' ), 10, 3 );

    to

    add_filter( 'tablepress_table_evaluate_data', array( __CLASS__, 'process_parameters' ), 10, 3 );

    It will then also not matter if you insert that extra column as the first or last column, and the highlighting should work with the hidden column as well.

    Regards,
    Tobias

    Thread Starter bandit1730

    (@bandit1730)

    hi!!

    Sorry Tobias, but it didn’t work (it only works if “shown”. See bottom of table)
    https://123corporatetransportation.com/destinations/ny-car-service-to-jfk-lga-ewr-swf-airport-pickup-suv-van-bus-limo/
    ******************************************************************************
    public static function init() {
    add_filter( ‘tablepress_shortcode_table_default_shortcode_atts’, array( __CLASS__, ‘shortcode_attributes’ ) );
    add_filter( ‘tablepress_table_evaluate_data’, array( __CLASS__, ‘process_parameters’ ), 10, 3 );
    }
    *****************************************************************************

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ok, that’s strange, but I haven’t looked at the code for while.

    Regardless, we can then simply use a different way of hiding the table, namely via CSS.
    So, for example, try adding this to the “Custom CSS” textarea on the “Plugin Options” screen:

    .tablepress-id-nys .column-1 {
      display: none;
    }

    Regards,
    Tobias

    Thread Starter bandit1730

    (@bandit1730)

    Awesome… This fixes the the and resolves the thread.
    I will start a responsive table thread and see if I can get it going (I am thinking using just the “phone” since I have to change the layout. I hope there is a way to use a different table or use CSS get the desired output).

    Thanks for your prompt replies.

    Note: I am making a donation (Last time I checked, your Amazon wish list link is broken)

    Joseph

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Joseph,

    great, good to hear that this helped! ??

    Yes, the “phone” setting for the Responsive Tables Extension should work here. Otherwise, you could also try horizontal scrolling, via https://www.ads-software.com/support/topic/responsive-tables-scroll-only?replies=6#post-5511954

    And thanks for the donation, I really appreciate that!
    Also thanks for the hint about the wish list links! I moved to a different server last week and apparently forgot to set up some redirects… Should be fixed now ?? Thanks!

    Best wishes,
    Tobias

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Changing multiple "rows" from to’ is closed to new replies.