Jump to content

Css For Spry Dataset


Guest Jim Paull
 Share

Recommended Posts

Guest Jim Paull

First time here and while I believe my post goes in this section, please move if I'm wrong. That said the answer could probably in any number of sections. I've searched the forums here and elsewhere, the tutorials, the web, and have tried to Easter Egg it for days. Goal: To assign text color based on values (i.e., 100%-75% green, 75%-50% yellow, 50%-25% orange, 25%-0% red.)The data in question is generated by a spry:repeat (method?!?) as a string 0.0% - 100.0% (e.g. 52.3%, 100.0%, 9.5%, etc.)I can assign a unique id for each td:Plain-no id Spry repeat / Live Code:

<td>{attendance_30}</td>  /  <td>94.4%</td>

Modified for ids Spry repeat / Live Code:

<td id={attendance_30}>{attendance_30}</td>  /  <td id="94.4%">94.4%</td>

So while I can make a td[id=94.4%] {color:#0F0} entry, doing it for the other 999 possible values seems tedious. I've tried getelementbyid methods, onload, and more then I can remember. Any ideas?Thanks for any advice or points in the right direction.

Link to comment
Share on other sites

I'd use Javascript (or PHP if possible) to check the number and assign a class to the <td> instead. This way you only have three classes: .red, .yellow and .green.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...