• Resolved crispyollard

    (@crispyollard)


    Hey.

    I’ve not been using this plugin long but so far it looks fantastic. Just one thing I’m trying to work out:

    Is it possible to highlight a row based on a value within it?

    For example: if a row contains the word YES it would highlight it green?

    I checked within your FAQ and you describe using a span style to highlight a specific value manually but wondered if it was possible to do this automatically AND for the whole row.

    Many thanks. ??

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

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

    (@tobiasbg)

    Hi,

    thanks for your question.

    This is possible with the Premium TablePress Extension from https://tablepress.org/download/extension/tablepress-row-highlighting.zip that needs to be installed and activated.
    You can then use a Shortcode like

    [table id=123 row_highlight="YES" /]

    that will look for “YES” in the table.
    Rows with the found highlight term in a cell will get a CSS class like “row-highlight-yes”. This can then be styled with “Custom CSS” like

    .tablepress-id-123 .row-highlight-yes td {
    	background-color: #ff0000 !important;
    }

    Regards,
    Tobias

    Thread Starter crispyollard

    (@crispyollard)

    Wow. Superfast response. I’ll take a look. Thanks!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    sure, no problem. I hope it helps! ??

    Regards,
    Tobias

    Thread Starter crispyollard

    (@crispyollard)

    Hmmm.. Just wondering if you would have to declare each table in CSS or whether you could make the highlight colour global?

    Also – where’s the link to this plugin on your site? Seem to be blind to the link!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    sure, just use the global CSS class that affects all tables, as described in the TablePress documentation:

    .tablepress .row-highlight-yes td {
    	background-color: #ff0000 !important;
    }

    About the link on the site: You’ll not find it, as I haven’t yet had the time do add it ??

    Regards,
    Tobias

    Thread Starter crispyollard

    (@crispyollard)

    Great!

    I’ve got it all inserted now but no highlight.

    Definitely will add a few dollars for your efforts later. ??

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ok, a few steps to check here:
    – Did you really activate the new plugin?
    – Did you modify the Shortcode?
    – Does the table contain the exact word in a cell (by default, the Extension does exact cell matching)?
    – Did you add the “Custom CSS”?

    Can you maybe post a link to the page with the table, as well as the Shortcode that you used?
    And thanks for wanting to donate, I really appreciate it!

    Regards,
    Tobias

    Thread Starter crispyollard

    (@crispyollard)

    My bad. I use YES as an example but my word was actually different. ??

    .tablepress .row-highlight-yes td {
    background-color: #ff0000 !important;
    }

    I didn’t pick up the correlation of the phrase in the CSS code also. Now I’ve altered it accordingly and… Success!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    great! Good to hear that it is working now ??
    And thanks for the donation, I really appreciate it!

    Best wishes,
    Tobias

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

    can you do this for multiple key words or only a single? exmaple:

    [table id=7 row_highlight=”QB” row_highlight=”RB” /]

    With the CSS

    .tablepress .row-highlight-qb td {
    background-color: #00FF00 !important;
    }

    .tablepress .row-highlight-rb td {
    background-color: #0000FF !important;
    }

    Reason why I ask is because I can’t get it to work.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    In that case, you would have to put the desired words in one parameter value, separated by ||:

    [table id=7 row_highlight="QB||RB" /]

    Regards,
    Tobias

    you dah man tobias

    Plugin Author TobiasBg

    (@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!

    One last question, and it is a question.

    Are we able to use wildcards of some sort like:
    [table id=7 row_highlight=”*QB||*RB” /]

    Meaning, it could recognize anything before QB as part of the parameter to highlight the row? Just a question, didn’t want to create a new ticket to atleast keep all my questions together in the one thread.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    this is not directly possible with wildcards like *, but you can tell the Extension to look anywhere in the cell:

    [table id=7 row_highlight="QB||RB" row_highlight_full_cell_match=false /]

    (That would basically be the equivalent to "*QB*||*RB*" in your notation.)

    Regards,
    Tobias

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Highlight a Row Based on Value?’ is closed to new replies.