json - 如何使 SharePoint 库中的自定义列按钮仅在文件类型为“文件夹”时可见
问题描述
我有一个自定义按钮列(测试)
我想为仅在文件类型 = 文件夹时显示按钮设置条件。下面是我的 Json 代码,但不幸的是它不起作用。
{
"$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"
}
]
}
解决方案
SharePoint 库中有一个内容类型列,您可以通过判断该列的值来决定是否显示该按钮。
{
"$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"
}
]
}
推荐阅读
- docker - 无法通过 Chocolatey 卸载 Docker Desktop
- windows - Windows 注册表命令文件夹中的 --url -- 是什么意思?
- css - 如何显示行/行以使用 CSS 链接 2 个或更多元素?
- node.js - NodeJS 在没有 Express 的情况下获取 cookie
- sql - foreach 循环遍历 SQL 数据数组时出现 Powershell IComparable 错误
- ios - AzureIoTHubClient 包装器框架无法构建模块
- tensorflow2.0 - 给定一个输入并得到两个输出
- merge - Apache NiFi:MergeContent 无法正确合并文件
- ruby - Chef - 将环境变量与包资源一起使用,使用 bash 资源创建
- react-native - 将文件夹中的所有文件存储在变量中 react-native