1

I'm trying to remove column names from the grouped list. I followed the instructions given here: SharePoint Online list - format group headers to remove column name but I seem to have another issue.

I use project names that come from another sharepoint list. With the original JSON I got Object Object instead of Project name.

When I replaced @group.fieldData.displayValue with @group.fieldData.title however, it just returned blank for me as in 'black space (26)'. Any ideas? Thank you!

3
  • Are you applying grouping on lookup column? Dec 7, 2021 at 10:01
  • Yes, I'm applying grouping on a lookup column. Is that a problem?
    – Marlena
    Dec 7, 2021 at 10:14
  • No problem, check my answer below for lookup columns. Dec 7, 2021 at 10:23

1 Answer 1

1

For grouping on lookup columns, use following JSON in view formatting:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
  "groupProps": {
    "headerFormatter": {
      "elmType": "div",
      "style": {
        "padding-left": "12px",
        "font-size": "16px",
        "font-weight": "400",
        "cursor": "pointer",
        "outline": "0px",
        "white-space": "nowrap",
        "text-overflow": "ellipsis"
      },
      "children": [
        {
          "elmType": "div",
          "children": [
            {
              "elmType": "span",
              "style": {
                "padding": "5px 5px 5px 5px"
              },
              "txtContent": "@group.fieldData.displayValue.lookupValue"
            }
          ]
        },
        {
          "elmType": "div",
          "children": [
            {
              "elmType": "div",
              "style": {
                "display": "flex",
                "flex-direction": "row",
                "justify-content": "center"
              },
              "children": [
                {
                  "elmType": "div",
                  "txtContent": "=' (' + @group.count + ')'"
                }
              ]
            }
          ]
        }
      ]
    }
  }
}

Use @group.fieldData.displayValue.lookupValue instead of @group.fieldData.displayValue.

Documentation: View formatting - List layout customizations

1
  • 1
    Ganesh, this is fantastic - worked perfectly! Many thanks!
    – Marlena
    Dec 7, 2021 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.