question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conditionally coloring a cell (not row) based on its value

See original GitHub issue

What version of React-Table are you using?

6.7.6

What bug are you experiencing, or what feature are you proposing?

I don’t know how to conditionally color a CELL based on it’s value. I’ve read the README, and can conditionally color a row like this:

            getTdProps={(state, rowInfo, column, instance) => {
                return {
                    style: {
                        background: rowInfo.row.severity == "HIGH" ? "green" : null
                    }
                };
            }}

Here, if the cell’s value is “HIGH”, the entire ROW is green. What I’d like is for just that cell to be green. How do I do that? A simple example would be nice.

Thanks!

Use https://codesandbox.io/s/X6npLXPRW (by clicking the “Fork” button) to reproduce the issue.

https://codesandbox.io/s/4jo143r80w

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
mendesfelipe87commented, Nov 27, 2018

fixed! for future references

https://codesandbox.io/s/744n0nmvl0

0reactions
ghostcommented, Apr 26, 2021

Currently not working in V7

Read more comments on GitHub >

github_iconTop Results From Across the Web

Highlight Rows Based on a Cell Value in Excel (Conditional ...
Want to highlight rows based on a cell value? In this tutorial, I will show you how to use Conditional Formatting to highlight...
Read more >
Excel Conditional Formatting Entire Row Based on Cell Value
In Microsoft Excel, with a few easy steps, you can apply conditional formatting that checks the value in one cell, and applies formatting...
Read more >
Use conditional formatting to highlight information
Under Select a Rule Type, click Format all cells based on their values (default). Under Edit the Rule Description, in the Format Style...
Read more >
Excel: Change the row color based on cell value - Ablebits
Learn how to quickly change the color of the entire row based on a single cell's value in Excel 2016, 2013 and 2010....
Read more >
Excel Conditional Formatting Based on Another Cell
This post explores the details of formatting a cell or range based on the value in another cell.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found