0

-I copied this image from a post on answers.microsoft.com, and am having the same issue.

-I know that a user can enlarge the "name" field on their workstation and it should stick for them, but I want the name field to fill the area so they do not have to enlarge it.

-I have tried setting the width of the name on the document library and then saving the view. It works for me, but not for others.

-Any ideas on how I can set a default width on the "Name" field on a document library so users do not have to adjust the width?

Example from answers.microsoft.com - not my screen shot but same problem

3 Answers 3

1

If we use Json format as shown below to change the width of column value:

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

The field value width has been modified with 500px:

enter image description here

However this doensn't work for the column bar, which means JSON format can not achieve this.It can only change inner div style.

enter image description here

We suggest you use SPFx extension to inject css file change outer div style.

Similar issue for your reference:

https://stackoverflow.com/questions/64051071/how-to-increase-the-width-of-a-sharepoint-online-list-column-within-a-list-webpa

0

Unfortunately, in Modern Views in SPO, we can't set default width for [Name] column in Document Library. I was hoping that we could use JSON formatting. However, it's not supported for the following columns:

  • Managed Metadata
  • Filename (in Document Libraries)
  • Retention Label
  • Sealed columns
  • Multi-Line Text column with enhanced rich text

More info on column formatting can be found here

0

I did not implement a solution to our regular document libraries yet since it is adjustable if the users know to click and drag the edge of the column headers. Unfortunately it's not very intuitive for the average user.

I did take the effort to change the "site pages" library since the name field is NOT expandable.

I used the https://github.com/hugoabernier/react-application-injectcss solutions and the following code to override the inline styles. So far no adverse changes in any other areas (fingers crossed).

.od-DetailsRow-cell--Name {width: 400px !important;}
.od-DetailsHeader-cell--Name {width: 400px !important;}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.