SharePoint Online - JSON won't narrow first column in document library

vrm 711 Reputation points
2023-08-09T10:15:57.35+00:00

While the following code narrows other columns in the document library, it doesn't narrow the first column. Why? Thanks

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "style": {
    "width": "100px",
    "word-break": "normal",
    "white-space": "wrap"
  },
  "children": [
    {
      "elmType": "span",
      "txtContent": "@currentField"
    }
  ]
}
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,230 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yanli Jiang - MSFT 31,566 Reputation points Microsoft External Staff
    2023-08-10T06:04:09.4+00:00

    Hi @vrm ,

    I tested it with the JSON code you provided and it works. Have you tried it in another library?

    User's image

    If column formatting still doesn't work, maybe you can take this method as an alternative into consideration. Hide column header using the syntax and create custom column header using JSON. See this demo: hideColumnHeader

    https://learn.microsoft.com/en-us/answers/questions/591263/fixed-column-header-width-in-lists .


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.