我正在尝试对我的SharePoint列表使用一个简单的格式,使用JSON根据行索引和“审批状态”设置颜色的格式,一个简单的逻辑如下:
If the status is approved:
for each devise the index by 2 and if the reminder is equal to 0 show a slightly lighter color
,otherwise a darker color (pretty standard formatting)
If the status is not Approved
if Status is Pending, use orange
if status is Rejected, use red基于行索引的着色可以很好地工作,状态的着色也可以,但不能将这两者放在一起。
{
"additionalRowClass": {
"operator": ":",
"operands": [
{
"operator": "&&", "operands": [
{ "operator": "==", "operands": ["[$_ModerationStatus]","Approved"] },
"operator": "==",
"operands": [
{
"operator": "%",
"operands": [
"@rowIndex",
2
]
},
0
]
]
},
"sp-css-backgroundColor-neutralBackground",
{
"operator": ":",
"operands": [
{
"operator": "&&", "operands": [
{ "operator": "==", "operands": ["[$_ModerationStatus]","Approved"] },
"operator": "==",
"operands": [
{
"operator": "%",
"operands": [
"@rowIndex",
2
]
},
1
]
},
"sp-css-backgroundColor-noFill",
""
]
}
}
}发布于 2020-07-17 16:20:47
下面是我的演示JSON代码,供您参考:
{
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass":"=if([$Status]=='Approved',if(@rowIndex%2==0,'sp-css-backgroundColor-neutralBackground','sp-css-backgroundColor-noFill'),if([$Status]=='Pending','ms-bgColor-orangeLight',if([$Status]=='Rejected','ms-bgColor-red',''))"
}测试结果:

https://stackoverflow.com/questions/62944890
复制相似问题