2

I have a SharePoint Online list that contains employee documents for each of our staff members.

I keep it grouped by employee name which is great, but the word 'Employee:' before each name is really bugging me.

Is there a way to remove the name of the column that appears before the grouping?

For Example:

enter image description here

Should read as:

enter image description here

I've seen posts and videos using JSON to format the grouping with background colors, icons, custom text etc. but I can't isolate what's needed to just remove the column name. I'm super new at all this stuff and just finding my way through things at the moment.

0

1 Answer 1

3

Use below JSON to format list view:

{
  "$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"
            }
          ]
        },
        {
          "elmType": "div",
          "children": [
            {
              "elmType": "div",
              "style": {
                "display": "flex",
                "flex-direction": "row",
                "justify-content": "center"
              },
              "children": [
                {
                  "elmType": "div",
                  "txtContent": "=' (' + @group.count + ')'"
                }
              ]
            }
          ]
        }
      ]
    }
  }
}

List view without JSON formatting:

enter image description here

List view with JSON formatting:

enter image description here

Documentation: Use view formatting to customize SharePoint


Update from comments:

For person or group fields, replace @group.fieldData.displayValue with @group.fieldData.title in above JSON & it should work for you.

Output:

enter image description here

5
  • Thank you. I copied the JSON exactly and this is what it gave me. [object Object] (16). So I have removed the Column name, thank you. But I've also lost the names of the employees.
    – Kat
    Sep 29, 2021 at 22:39
  • Where are you adding this JSON? You have to add it under "format this view" (view formatting) option & not column formatting. Sep 30, 2021 at 4:05
  • Yes that's where I put it. Format Current View > Format View > Advanced Mode. It takes away the employee names completely. I don't know if it impacts anything, but I get the employee names from a people picker of current site members, it's not a manual entry into the Title (or similar) column.
    – Kat
    Oct 4, 2021 at 21:59
  • Check updated answer for person or group columns. Oct 6, 2021 at 5:30
  • 1
    That did it. Thank you!
    – Kat
    Oct 11, 2021 at 23:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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