SPO modern list column width

Brass Contributor

Hi All,

I am on SPO and my modern lists will not resize the columns based on the the content.  All my column names are longer than the width of the column, and you have to maually expand each column every time you go into the list, this is very user unfriendly...

 

Is there a way to change the size of the colmns based on content, or specify a column width?  As an SPO tenant, I don't believe I have rights to chage the CSS, and even if I do, I am not comfortable with changing something that Microsoft may overwrite with an update.

 

TIA,

Joe

7 Replies

Sure, There is a way you can change the width with code.

 

If you have the admin rights to do it, you could, but you are correct, Microsoft could release an update and it could overwrite your code.

 

Its just something you have to determine if its worth it or not.

Hi David,

Would you happen to have a link to some sample code?

Do you know if the code would be for a site collection, or per list? 

If it's per list I can pick and choose more import lists and keep my finger crossed :)

 

Thanks again,

Joe

I do not, but google has a ton of different articles with different codes. I would say see which one works for you. I found Js Scripts & CSS scripts. Just depends on which one you feel more comfortable with.
AFAIK, the only way to customize columns width in a modern list is by means of the JSON formating but I don't recall seeing this use case. JSON formatting is awesome to change how the list looks like so it should be technically possible. JSON formatting is available at two scopes:
(1) List coulumn.
(2) List view (Coming in september)

I haven't tested this myself yet, but maybe the new list view formatting will solve the problem. It is in the portal Message Center and referenced as Roadmap Item 32990:

 

"With this change, you’ll be able to improve the display of views in SharePoint Online lists with formatting. The view formatting text describes the elements that are displayed and their display style. The data in the list doesn't change. Anyone who can create and manage views in a list can access view formatting from the View options menu. We'll be gradually rolling this out to Targeted Release organizations in late August, and the rollout will be completed worldwide by the end of September."

 

Thanks Courtney,

I will look at the message.  I really was not a fan of adding code to all lists just so they get blown away from a MicroSoft update :)

 

 

Oh man,

I should have read the article before responding.

I can't believe I will still need to add Json to every list. :(