TransWikia.com

Icons will not appear on SharePoint Site

SharePoint Asked by Jyojibh on December 26, 2021

As you can see below in the Status column I have the desired colors in the correct manner however for some reason I cannot get the icons to work next to them, the originally worked and now they wont Am i being blind.

I’m sure its a super simple solution however I cannot seem to get it working again.

    {
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "style": {
    "color": "#fff",
    "padding-left": "14px",
    "background-color": {
      "operator": "?",
      "operands": [
        {
          "operator": "==",
          "operands": [
            "@currentField",
            "Change Req"
          ]
        },
        "#EA2027",
        {
          "operator": "?",
          "operands": [
            {
              "operator": "==",
              "operands": [
                "@currentField",
                "In Progress"
              ]
            },
            "#F79F1F",
            {
              "operator": "?",
              "operands": [
                {
                  "operator": "==",
                  "operands": [
                    "@currentField",
                    "No Changes"
                  ]
                },
                "#009432",
                ""
              ]
            }
          ]
        }
      ]
    }
  },
  "children": [
    {
      "elmType": "span",
      "txtContent": "@currentField",
      "style": {
        "display": "inline-block",
        "padding": "0 4px"
      },
      "attributes": {
        "iconName": "=if(@currentField == 'No Changes','CheckMark')"
      }
    }
  ]
}

enter image description here

One Answer

Try using below JSON code:

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    "elmType": "div",
    "style": {
        "color": "#fff",
        "padding-left": "14px",
        "background-color": "=if(@currentField == 'Change Req', '#EA2027', if(@currentField == 'In Progress', '#F79F1F', if(@currentField == 'No Changes', '#009432', '')))"
    },
    "children": [
        {
            "elmType": "span",
            "txtContent": "@currentField",
            "style": {
                "display": "inline-block",
                "padding": "0 4px"
            },
            "attributes": {
                "iconName": "=if(@currentField == 'No Changes', 'CheckMark', '')"
            }
        }
    ]
}

Answered by Ganesh Sanap on December 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP