如何使用JSON在sharepoint中显示多选选项列的自定义标题?

如何使用JSON在sharepoint中显示多选选项列的自定义标题?,json,sharepoint,Json,Sharepoint,我在SharePoint的多选栏中有首字母缩写。 我想显示描述首字母缩略词的标题。例如,当我将鼠标移到ATZ上时,可能希望它说“在动物园-ATZ”。 我只是在学习如何使用它,似乎找不到为循环中的每个$ChoiceIterator分配字符串的方法。我可以在标题中添加$ChoiceIterator,但我想为每个标题添加一个唯一的描述 谢谢 我试过这个网站的样品 在“标题”后使用此剪报:并尝试适当地插入我的$ChoiceInterator "=if(indexOf(join(@currentField

我在SharePoint的多选栏中有首字母缩写。 我想显示描述首字母缩略词的标题。例如,当我将鼠标移到ATZ上时,可能希望它说“在动物园-ATZ”。
我只是在学习如何使用它,似乎找不到为循环中的每个$ChoiceIterator分配字符串的方法。我可以在标题中添加$ChoiceIterator,但我想为每个标题添加一个唯一的描述

谢谢

我试过这个网站的样品

在“标题”后使用此剪报:并尝试适当地插入我的$ChoiceInterator

"=if(indexOf(join(@currentField,''),'dog') != -1, 'Yes', 'No')
但结果很简单,它为每个图标选择显示相同的文本

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "forEach": "choiceIterator in @currentField",
      "elmType": "div",
      "txtContent": "[$choiceIterator]",
      "attributes": {
        "class": "ms-bgColor-themePrimary ms-fontColor-white",
        "title": "='This should describe the license... ' + [$choiceIterator]"
      },
      "style": {
        "width": "27px",
        "height": "16px",
        "text-align": "center",
        "margin": "2px"
      }
    }
  ]
}

Span使用标题作为工具提示,因此可以将标题设置为每个Span的详细说明

你可以使用很多图标


Span使用标题作为工具提示,因此您可以将标题设置为每个Span的详细说明

你可以使用很多图标


所以上面的答案是可行的,但它始终显示所有图标。在我的例子中,我不想要图标,我希望能够在我的多选栏中创建和选择自定义首字母缩写词

要使示例变得简单,请执行以下操作: 我有一列客户名单。一列是客户购买的产品的自定义功能的多选

有3个名称较长的自定义选项。 长褐玉米 大橙牛 宽粉色比斯基特

如果客户拥有所有3个功能,我不想用这些长名称挤满我的专栏。所以我想将它们显示为缩写,并在鼠标上方弹出标题。 LBC、BOC、WPB

请注意,在此行末尾,您需要额外的空白引号“”。我想这是IF语句的另一部分

“标题”:“=如果([$choiceIterator]=='BOC','Big Orange Cow',如果([$choiceIterator]=='LBC','Long Brown Corn',如果([$choiceIterator]=='WPB','Wide Pink Biskit','”)


因此,上面的答案是可行的,但它始终显示所有图标。在我的例子中,我不想要图标,我希望能够在我的多选栏中创建和选择自定义首字母缩略词

要使示例变得简单,请执行以下操作: 我有一个按行排列的客户列表,其中一列是客户购买的产品自定义功能的多选

有3个名称较长的自定义选项。 长褐玉米 大橙牛 宽粉色比斯基特

如果客户拥有所有3个功能,我不想用这些长名称挤满我的专栏,所以我想在鼠标上方用一个弹出标题将它们显示为缩写。 LBC、BOC、WPB

请注意,在此行末尾,您需要额外的空白引号“”。我认为这是IF语句的ELSE部分

“标题”:“=如果([$choiceIterator]=='BOC','Big Orange Cow',如果([$choiceIterator]=='LBC','Long Brown Corn',如果([$choiceIterator]=='WPB','Wide Pink Biskit','”)

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "style": {
    "font-size": "16px"
  },
  "children": [
    {
      "elmType": "span",
      "attributes": {
        "title": "Water Description",
        "iconName": "Precipitation",
        "class": "='ms-fontColor-' + if(indexOf(join(@currentField,''),'Water') != -1, 'themeDark', 'neutralLight')"
      },
      "style": {
        "padding": "0 2px"
      }
    },
    {
      "elmType": "span",
      "attributes": {
        "title": "Coffee Description",
        "iconName": "CoffeeScript",
        "class": "='ms-fontColor-' + if(indexOf(join(@currentField,''),'Coffee') != -1, 'themeDark', 'neutralLight')"
      },
      "style": {
        "padding": "0 2px 0 0"
      }
    },
    {
      "elmType": "span",
      "attributes": {
        "title": "Wine Description",
        "iconName": "Wines",
        "class": "='ms-fontColor-' + if(indexOf(join(@currentField,''),'Wine') != -1, 'themeDark', 'neutralLight')"
      },
      "style": {
        "padding": "0 2px"
      }
    },
    {
      "elmType": "span",
      "attributes": {
        "title": "Beer Description",
        "iconName": "BeerMug",
        "class": "='ms-fontColor-' + if(indexOf(join(@currentField,''),'Beer') != -1, 'themeDark', 'neutralLight')"
      },
      "style": {
        "padding": "0 2px"
      }
    },
    {
      "elmType": "span",
      "attributes": {
        "title": "\"Juice Description more...\"",
        "iconName": "MusicInCollectionFill",
        "class": "='ms-fontColor-' + if(indexOf(join(@currentField,''),'\"Juice\"') != -1, 'themeDark', 'neutralLight')"
      },
      "style": {
        "padding": "0 2px"
      }
    }
  ]
}
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "forEach": "choiceIterator in @currentField",
      "elmType": "div",
      "txtContent": "[$choiceIterator]",
      "attributes": {
        "class": "ms-bgColor-themePrimary ms-fontColor-white",
        "title": "= if([$choiceIterator] == 'BOC', 'Big Orange Cow', if([$choiceIterator] == 'LBC', 'Long Brown Corn', if([$choiceIterator] == 'WPB', 'Wide Pink Biskit', '' )"
      },
      "style": {
        "width": "28px",
        "height": "16px",
        "text-align": "center",
        "margin": "2px"
      }
    }
  ]
}