Skip navigation
Currently Being Moderated

CFGRID: How can you conditionally change the background of a particular cell?

Apr 17, 2012 2:21 PM

Tags: #cfgrid #cf9

Hello,

 

I currently have a table that displays the data from a query.  I would like to make it more flexible so I would like to use CFGRID to output the information instead (for pagination, sorting, outputting to MS Excel etc.).

 

However, I need to change the cell color of certain fields based on the data in those fields.  For instance, if the value in the certain field is 0-30 I need it to be red, if it is 31-60 I need it to be yellow and 61-100 I need it to be green.

 

I remember doing this last summer for one of my clients, but I was under a fairly strict NDA and couldn't keep any of my notes/code and I don't recall much about how I went about doing this.  There is probably a better way than what I did in any event.

 

I think it had something to do with writing the query to a new query and wrapping the values with some CSS code for the color as i processed it.

 

I rather doubt that I am the first person to ask this question, but I haven't been having much luck finding the answer so far.  If someone can help me figure this out, it would be greatly appreciated.  If anyone knows of an existing answer already in these forums, that would be awesome!

 

Best regards,

KK

 
Replies
  • Currently Being Moderated
    Apr 17, 2012 6:53 PM   in reply to Krandolph

    Do a search on cfgrid custom cell renderer.  There are a bunch of examples, such as:

    http://blog.alagad.com/2010/03/31/ask-an-alagadian-how-can-i-style-a-c ell-in-lt-cfgrid-gt-based-on-the-data-it-contains/

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points