首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使SharePoint库中自定义列的按钮仅在文件类型为“文件夹”时可见

如何使SharePoint库中自定义列的按钮仅在文件类型为“文件夹”时可见
EN

Stack Overflow用户
提问于 2021-03-19 17:49:42
回答 1查看 88关注 0票数 0

我有一个自定义的按钮列(Test)

我想设置当文件类型= folder only时显示按钮的条件。下面是我的Json代码,但不幸的是它不能工作。

代码语言:javascript
运行
复制
  {
  "$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
  "elmType": "button",
  "customRowAction": 
{
    "action": "executeFlow",
    "actionParams": "{\"id\": \"\"}"


  },
  "style": {
    "border": "none",
    "background-color": "transparent",
    "color": "#0078d7",
    "cursor": "pointer",
"display": "=if(  ([$Type] == 'Folder' ), 'block', 'none')"
  },
  "children": [
    {
      "elmType": "span",
      "attributes": {
        "iconName": "FollowUser"
      },
      "style": {
        "padding-right": "6px"
      }
    },
    {
      "elmType": "span",
      "txtContent": "click to start"
    }
  ]
}

EN

Stack Overflow用户

回答已采纳

发布于 2021-03-22 10:31:21

SharePoint库中有一个内容类型列,您可以通过判断该列的值来决定是否显示该按钮。

代码语言:javascript
运行
复制
{
  "$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
  "elmType": "button",
  "customRowAction": 
{
    "action": "executeFlow",
    "actionParams": "{\"id\": \"\"}"


  },
  "style": {
    "border": "none",
    "background-color": "transparent",
    "color": "#0078d7",
    "cursor": "pointer",
"display": "=if(  ([$ContentType] == 'Folder' ), 'block', 'none')"
  },
  "children": [
    {
      "elmType": "span",
      "attributes": {
        "iconName": "FollowUser"
      },
      "style": {
        "padding-right": "6px"
      }
    },
    {
      "elmType": "span",
      "txtContent": "click to start"
    }
  ]
}

测试结果:

票数 1
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66705898

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档