Forum Moderators: open

Message Too Old, No Replies

Row color based on cell content

grouping rows in a table by a common value, then color coordinated

         

dreeves

7:58 pm on Nov 5, 2009 (gmt 0)

10+ Year Member



I've got a large table with each record being an invoice. It is possible for 3 invoices to have the same request number. I would like for all the invoices with the same request number to have the same background color.
So, three fields: request_number, invoice_amount, invoice_date

I've never tempted javascript, so be nice when explaining it to a new guy. I'm assuming javascript would be the best way to accomplish this. This web site has got the right idea, but I couldn't figure out how to change the example code to work with my script.
<snipped url>

[edited by: whoisgregg at 1:55 pm (utc) on Nov. 6, 2009]
[edit reason] Whoops, no URLs please. See TOS [webmasterworld.com] :) [/edit]

whoisgregg

1:58 pm on Nov 6, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, dreeves!

Are you interested in reording the table rows based on user actions? For example, the user would enter a request number then, without the page refreshing, those rows would shift position and change their background color?

Or are you just looking to have alternating background colors, except for rows matching a specific value?

Also, how are you generating the table in the first place: using a server side language like PHP or manually by editing the HTML?

dreeves

2:33 pm on Nov 6, 2009 (gmt 0)

10+ Year Member



I am using PHP to retrieve the requests from the server, then they are displayed in a table in order of increasing request number. Once they are output, I do not plan on letting the user change anything about the way they are displayed. Every request does not need a unique color, 3 would be fine, I would just like them color coded so they can be easily interpreted by the user. So, all of the invoices with a request number of 67 will be the same color, and all of the invoices with a request number of 55 will be a different color, and so on...