You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SharePoint Online列表视图JSON格式失效,编辑表单正常

SharePoint Online列表视图条件格式失效问题修复

问题出在列表视图对background-color空值的解析逻辑上——表单能识别空字符串''为无背景,但列表视图不行,得换成transparent(透明)或者inherit(继承父背景)才能生效。

修改后的JSON代码如下:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "color": "=if( [$Step5Complete] == true, '#000000','#FFFFFF')",
    "font-weight": "bold",
    "background-color": "=if([$Step5Complete] == true,'transparent', if(@currentField >= @now + 1209600000, 'green', if(@currentField < @now, 'red','yellow')))"
  }
}

核心修改点:将原代码中[$Step5Complete] == true对应的背景色值从''替换为'transparent',这样列表视图会正确渲染透明背景,同时保持表单中的显示逻辑不变。

内容的提问来源于stack exchange,提问作者user23616112

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 08:09:55