共享点列表自定义JSON视图在列表Web部件中无法正确显示

时间:2020-01-30 07:41:11

标签: css json sharepoint sharepoint-list

我有一个自定义JSON列表视图,该视图可正确显示为列表,但未在列表Web部件中保留其格式。几周前我创建它时还可以,但是发生了一些变化(也许是Sharepoint更新?)

This is how it looks as list

And this is how it looks in web-part

我想使其在Web部件中更紧凑,并且没有标题。

这是我的JSON代码,几周前正确运行。现在看来,web部件中的hideColumnHeader和height标签已被忽略

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
  "hideSelection": true,
  "hideColumnHeader": true,
  "rowFormatter": {
    "elmType": "a",
    "txtContent": "@currentField",
    "attributes": {
      "class": "sp-field-fontSize14  ms-fontColor-neutralPrimary ms-fontColor-red--hover",
      "href": "[$Link]"
    },
    "style": {
      "text-decoration": "none",
      "width": "300px",
      "min-width": "200px",
      "min-height": "1em",
      "height": "1em",
      "white-space": "nowrap",
      "padding-left": "=if(indexOf(@currentField, ' ') == 1, '', if(indexOf(@currentField, ' ') == 3, '20px', '40px'))"
    }
  }
}

我正在使用SharePoint Online的现代体验。修复此问题的任何帮助都将不胜感激!

2 个答案:

答案 0 :(得分:0)

作为一种解决方法,我们可以将以下CSS样式添加到 modern script editor webpart 中,以隐藏列标题。

<style>
.ms-DetailsList-headerWrapper{
    display:none !important;
}
</style>

或使用以下解决方案注入自定义CSS。

SPFx Applications Customiser CSS Injection

答案 1 :(得分:0)

原来是Microsoft的一个错误,今天已在我们的租户中修复。

相关问题