我对 SharePoint 自定义场景还很陌生,但是已经掌握了一些 javascript,它们将根据单元格的值更改 SP 列表中单元格的背景颜色。
这在普通视图上工作正常,但任何分组的东西都不起作用,我相信这与页面加载的顺序有关。有没有办法将 javascript 应用于分组并设置为默认折叠的视图?
我从去年看到另一个线程有类似的查询,但似乎没有解决方案。
提前谢谢了!!!
担
这是我用于单元格颜色更改的代码:
<script type="text/javascript" language="javascript">
var x = document.getElementsByTagName("TD") // find all of the TDs
var i=0;
for (i=0;i<x.length;i++)
{
if (x[i].className=="ms-vb2") //find the TDs styled for lists
{
if (x[i].innerHTML=="Green" && x[i].cellIndex==10)
{
x[i].style.backgroundColor='forestgreen'; // set the background color
x[i].style.color='Black'; //set the font color
}
if (x[i].innerHTML=="Amber" && x[i].cellIndex==10)
{
x[i].style.backgroundColor='Goldenrod'; // set the background color
x[i].style.color='Black'; //set the font color
}
if (x[i].innerHTML=="Red" && x[i].cellIndex==10)
{
x[i].style.backgroundColor='Firebrick'; // set the background color
x[i].style.color='black'; //set the font color
}
}
}
</script>