I want to change the column width of a List in SharePoint Online. I have tried to do it with a script but it doesn’t work. Any ideas?
Hello,
I’ve tried the suggestion from techsp, but still only save it for me and not for everyone.
I’m using SharePoint Online with Modern views.
These are the steps I’ve followed to update it:
1- Select the view to modify
2- Expand the column with the mouse
3- Select “Save view as”
4- Keep the same name and also keep the check box “Make this a public view”
5- Click Save
6- Just to confirm, I’ve select another view and come back to the view I’ve just modified ; all looks good.
7- I’ve asked couple of users to log out and log back in and select that view
8- None of them got the update; am I missing something that I should do so they can see the changes ?
Anyone can tell me if Im missing something ?
Thanks in advance,
No scripts required.
This can be achieved by dragging the column to the size you want then go to your list of views and click “Save View as” then with out changing the view name click “Save”. this will save the column with the new default width.
Iain
The JSON Code mentioned above “style”: {
“width”: “100%”,will only change the width of the Column Style but not the width of the Column in the List View.
I have only been able to resize the columns manually every time I open the list. I haven’t been able to find anything that allows you to permanently change the column sizes. Will update if my development team has any ideas in the modern sites.
I haven’t tried it but it seems you can use ‘column-width’ JSON to change the width.
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting
i tried below code and it work for me 🙂
{
“$schema”: “https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json”,
“elmType”: “div”,
“txtContent”: “@currentField”,
“style”: {
“width”: “100%”,
“white-space”: “nowrap”
}
}
Why do you need to this? Only asking as there maybe another solution such as amending to the List’s View.