1

I am new to spfx but not to SharePoint. Has anyone been able to get min width to work for headers for all users in a Document Library view web part? I need to show all documents from a view and need the ability to filter a Category field but have the requirement for the headers to stay a certain width or at least not be smaller than a certain width for ALL users. As most are aware, even using JSON to set the min width when formatting a view doesn't work for all users. I see the width as it was set but another user sees the width smaller than the mid width set. The JSON in column formatting is as follows but min-width does not work. It still allows users to change the column width and initial display for other users is well below the min-width set: Test List View Image Other User Test List View

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "min-width": "1000px",
    "font-size": "14px",
    "font-weight": "600"
  }
}

Is there anything through PnP SPFx that I am not finding? What I need is a forms repository view (library) with the Category field filterable on the top page of the site but with the headers at a min width of 1000 px for everyone. Any help is very much appreciated.

1

1 Answer 1

0

From what I can see, there is no way you can control the width of columns using JSON formatting. This is because the width is controlled by the parent HTML elements. You are given a small "sandbox" DIV tag. You can "play around" within this DIV tag, but you won't be able to break out of it. You can set your column's width to be 1000 pixels, but it will still be cut out by the parent HTML elements.

Here you can see the green rectangle that is your column. And the Red rectangle highlights the parent that controls the width: enter image description here

Here you can see how the width is changed dynamically on the parent HTML elements:

enter image description here

1
  • Yes, thank you. I noticed that, too. Looking into the React information you sent and using SPFx. I appreciate your help.
    – GoGorilla
    Apr 5, 2021 at 21:59

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.