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

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    This should work for a character like - as well, but I’m not sure right now, what the CSS class for this will be (it might be possible that the double -- is changed to a single - by the used sanitization function). I suggest to use the “View source” function in the browser to find out which CSS class the matching cells got.

    Regards,
    Tobias

    Thread Starter F1st3R

    (@f1st3r)

    Thanks for the fast response. Yes, it seems to only take double variables, can I change this somehow?
    Just so you know, I am trying to color a row based on a value(if its negativ, red, if positiv, green). This is why I need the ‘-‘ to search through the table.

    All the best,
    Alex

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    you’d have to remove or alter the sanitization function, in the Extension’s PHP file.

    Can you tell me what the resulting CSS classes in the HTML code are (from that “View source” suggestion)?

    Regards,
    Tobias

    Thread Starter F1st3R

    (@f1st3r)

    Hey,
    Sorry, I’m not able to find the CSS classes by myself, but here is a link to the page with the table.
    Thanks again for helping me out again Tobias. Really appreciate it!

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    ok, thanks! And what’s the Shortcode that you are using for these?

    Regards,
    Tobias

    Thread Starter F1st3R

    (@f1st3r)

    Hey, here are the shortcodes! Thanks for looking into this!
    [table id=37 shortcodes_before_formulas=true row_highlight=”2″ /]
    [table id=37 shortcodes_before_formulas=true row_highlight=”-” /]
    [table id=37 shortcodes_before_formulas=true row_highlight=”+” /]

    and here are the options:

    .tablepress-id-37 .row-highlight-2 td {
    	background-color: #ff0000 !important;
    }
    
    .tablepress-id-37 .row-highlight-+ td {
    	background-color: #ff0000 !important;
    }
    
    .tablepress-id-37 .row-highlight-- td {
    	background-color: #ff0000 !important;
    }

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for that. I checked the code again, and unfortunately, the CSS classes for the - and the + will be the same ??
    You will therefore need to make a modification in the Extension’s PHP file. Please change line 200 of the tablepress-row-highlighting/tablepress-row-highlighting.php file from

    $row_class .= ' row-highlight-' . strtolower( sanitize_title_with_dashes( $highlight_term ) );

    to

    $row_class .= ' row-highlight-' . strtolower( $highlight_term );

    Regards,
    Tobias

    Thread Starter F1st3R

    (@f1st3r)

    Worked like a charm! Really big thanks for the help Tobias!

    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 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Highlight a Row Based on Value’ is closed to new replies.