2

I've been trying to hide a column header in a groupedby list on my Modern page. Since I haven't been successful (can't add a web part), I thought I might be able to format the column and add Json to change the color of the header to white. I haven't been able to find anything that works to hide the column, so I figure this might be my best option. Problem is, I don't know Json very well. Here's an image of the list. I just have to either hide the Column Header "Question", and the (1) number count. If I can't hide them, I'd like to change their font color to white. It obviously works if I change it when I open developer tools, but I can't save those changes.

Any help would be greatly appreciated.

enter image description here

2 Answers 2

1

You can hide the column headers using a View Format. But it sounds like you want to change the group headers (to not show the field name and the group count). Good news! You can do this too!

Here is my sample list with no formatting (renamed Title to Question, grouped by Title, and added an Answer field):

enter image description here

Here's a quick view format that both hides the column headers and adjust the group headers to just be the value of the question field:

{
    "hideColumnHeader": "true",
    "groupProps": {
        "headerFormatter": {
            "elmType": "div",
            "txtContent": "@group.fieldData"
        }
    }
}

Here's what that looks like:

enter image description here

To apply, just copy the format from above and choose Format View in the view dropdown, choose Advanced, and paste the JSON in.

1
  • 1
    This worked absolutely perfectly! Thank you so , so much for your assistance and walking me through it. You're a life savor!!
    – Chris
    Apr 14, 2021 at 17:48
0

We can't customize SharePoint List headers using JSON formatting. I hope someone correct me if I'm wrong. We can only control what's displayed inside a table cell.

However, you might trying applying the "Gallery" layout to your view. Then with some JSON formatting, you can change how the tiles are presented.

enter image description here

1
  • 1
    Thank you for the response. Unfortunately, my customer wants the list view to maintain it's style. They just want the "Question" and Number totals in parentheses to not display. Just to try it, I switched it back to Classic experience, used a Modern Script Editor Web Part, wrote some standard script to remove those two items, and it worked perfectly. Unfortunately they want this list in the modern experience. This modern experience won't allow me to edit the page and add a web part.
    – Chris
    Apr 14, 2021 at 15:35

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.