如果您使用jquery,可以向单元格添加数据属性以及一些标识符(例如类名),使您可以将其作为目标,然后让不引人注目的JS为您设置CSS类:
<tr>
<td class="coloredCell" data-availability="@PubSt.Planned_Prod_Implementation">stuff</td>
</tr>
然后使用JS将文档的颜色设置为就绪:
$(function ()
{
$('.coloredCell').each(function (index, element)
{
var availability = $(element).attr("data-availability");
var cssClass;
switch (availability)
{
case "Ready":
cssClass = "cssReadyState";
break;
case "Done":
cssClass = "cssDoneState";
break;
case "Skipped":
cssClass = "cssSkippedState";
break;
default:
cssClass = "";
break;
}
$(element).addClass(cssClass);
});
});