Warm tip: This article is reproduced from serverfault.com, please click

Button in Sharepoint list-条件可见度

(Button in Sharepoint list - conditional visibility)

发布于 2020-12-03 13:48:19

我想创建一个仅在“Zapůjčeno”列为空时才会显示的按钮。

    {
  "elmType": "button",
  "txtContent": "Odeslat Žádost",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"7347b7be-696f-46c8-bae8-78c230a354b3\"}"
  },
"style": {
"background-color": "#03A9F4",
"color": "white",
"visibility": {
"operator": "?",
"operands": [
{
"operator": "!=",
"operands": [
"[$ID]",
"1"
]
},
"hidden",
"visible"
]
}
}
}

“ ID”列的示例

如果我使用默认列“ ID”来尝试它,则可以,但是如果我想使用我的列“ Zapitjčeno”,它将不起作用。

感谢你的建议,我是SharePoint的新手。

Questioner
František Dolejší
Viewed
0
Rikking 2020-12-04 00:26:07

Zapůjčeno列内部名称与显示名称相同吗?你可以在列表/库设置中看到该列的内部名称,然后单击列名称。该列的内部名称将出现在URL中。

我认为你可以使用以下方式:

{
  "elmType": "button",
  "txtContent": "= if([$Zapůjčeno_Internal_Name]=='','Odeslat Žádost', '')",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "='{\"id\": \"' + if([$Zapůjčeno_Internal_Name]=='','7347b7be-696f-46c8-bae8-78c230a354b3','') + '\"}'"
  },
"style": {
"background-color": "#03A9F4",
"color": "white",
"visibility": {
"operator": "?",
"operands": [
{
"operator": "!=",
"operands": [
"[$ID]",
"1"
]
},
"hidden",
"visible"
]
}
}
}