SOLVED

Sharepoint Autofit column header of a list

Copper Contributor

I have created a list and some of the columns headers contain 3 or 4 words of text. These text headers shortened and dont display the full text. I have tried formatting the column width using JSON but that only applies to the column contents and not the header portion.

 

How do I auto fit the column headers?

Thanks.

 

 

 

 {
   "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
   "elmType": "div",
   "txtContent": "@currentField",
   "style": {
     "width": "500px"
   }
 }

 

 

 

1 Reply
best response confirmed by zapbrannigan (Copper Contributor)
Solution

@zapbrannigan This is a known limitation of JSON formatting. You cannot format only the column headers using JSON formatting in SharePoint online.

 

But you can manually increase the width of column header by dragging it to the right & save the list view.

For detailed steps, check: SharePoint Modern List - Increase column width with JSON Issue


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

1 best response

Accepted Solutions
best response confirmed by zapbrannigan (Copper Contributor)
Solution

@zapbrannigan This is a known limitation of JSON formatting. You cannot format only the column headers using JSON formatting in SharePoint online.

 

But you can manually increase the width of column header by dragging it to the right & save the list view.

For detailed steps, check: SharePoint Modern List - Increase column width with JSON Issue


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

View solution in original post