Forum Discussion

bryanfrumkin47's avatar
bryanfrumkin47
Copper Contributor
Feb 12, 2024

List Grouping

Hello! I truly appreciate all assistance

 

I have a list that is grouping my division name and then status, but I cannot get the header columns to be hidden.

Here is my view formatting JSON:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
  "groupProps": {
    "hideFooter": false,
    "headerFormatter": {
      "elmType": "div",
      "style": {
        "flex-wrap": "wrap",
        "display": "flex",
        "box-sizing": "border-box",
        "padding": "4px 8px 5px 8px",
        "border-radius": "6px",
        "align-items": "center",
        "white-space": "nowrap",
        "overflow": "hidden",
        "margin": "1px 4px 4px 1px"
      },
      "children": [
        {
          "elmType": "div",
          "style": {
            "display": "flex",
            "flex-direction": "row",
            "justify-content": "center"
          },
          "children": [
            {
              "elmType": "div",
              "txtContent": "= @group.fieldData.displayValue",
              "style": {
                "padding": "5px 5px 5px 5px",
                "font-weight": "500",
                "color": "=if(@group.fieldData.displayValue == 'Business Cards', '#8B4513', if(@group.fieldData.displayValue == 'Name Badge', '#FF6F61', if(@group.fieldData.displayValue == 'General Supplies', '#9400D3', 'DefaultColor')))"
              }
            },
            {
              "elmType": "div",
              "attributes": {
                "class": "=if(@group.fieldData.displayValue == 'Business Cards', 'ms-Icon--IDBadge', if(@group.fieldData.displayValue == 'Name Badge', 'ms-Icon--IDBadge', if(@group.fieldData.displayValue == 'General Supplies', 'ms-Icon--Box', '')))"
              },
              "style": {
                "font-size": "16px",
                "padding-left": "5px"
              }
            }
          ]
        }
      ]
    }
  }
}

 

Please let me know if you have any questions or concerns.

4 Replies

  • Rob_Elliott's avatar
    Rob_Elliott
    Silver Contributor

    bryanfrumkin47 you've grouped the list on the All items view. So create a new view with only the columns(s) you want to display and apply the JSON grouping formatting to that view.

     

    View with all columns (not the All items view which I keep for a normal view of the list):

     

    View with Just 2 columns:

     

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User.
    Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)

    • bryanfrumkin47's avatar
      bryanfrumkin47
      Copper Contributor

      Rob_Elliott 

      Hey Rob, 
      I created a new view, but when I open up the grouping, the status and division name reappear.

      Is it a bug causing this to happen because I was definitely able to hide these columns in the past

      • Rob_Elliott's avatar
        Rob_Elliott
        Silver Contributor
        Go into list settings, select the view and remove the columns from there and save.

Resources