question

LindaMackintosh-2886 avatar image
0 Votes"
LindaMackintosh-2886 asked LindaMackintosh-2886 commented

Sharepoint 0365 List Views - Columns

I have created a list for customers which contains a multiple line field which I have set a JSON code (shown below) in to ensure that the data is all seen as it is text wrapped however it only seems to work for single line fields and my field contains too much text for this. I have then created several views. The issue I have is that when moving back and forth to the views, the column for this text reduces automatically to around an inch in size. I can drag the column then save the view but if I go to another view and back then it reduces again. I am in a Modern view. How can I set the column width to prevent this or is there a JSON that will wrap the text but work for multiple lines ? I can add a width setting to the JSON but this then just prevents the column being made any bigger - the column still jumps to being smaller when you move to a different view. I am completely new to JSONs. Any advice welcome.

I have tried restarting the list and creating the views through List Settings as suggested in another forum but no joy.

Thank you


{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"white-space": "normal",
"padding": "11px 0"
},
"attributes": {
"class": "ms-fontColor-themePrimary"
}
}

office-sharepoint-online
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@LindaMackintosh-2886 Is there any progress on this issue? If my reply helps you, you could accept it as an answer to close this thread.

0 Votes 0 ·
MichaelHan-MSFT avatar image
1 Vote"
MichaelHan-MSFT answered MichaelHan-MSFT commented

After changing the column width by dragging it, you need to save the list view.

Please notice the “View” pull down in the top right of the page. You should see that once you change a column width on the page a * appears after the “View” name.
12551-1.png

Select the “View” pull down there will be an option to Save view as. Save the “View”, using the same name as before, you are overviewing the old display with the new layout i.e. with different column widths.

12464-2.png

Below is my test result:

12532-test.gif



1.png (2.5 KiB)
2.png (25.8 KiB)
test.gif (888.2 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi thank you. I have recreated my full list again over the last two days, creating each view using List Settings. I have moved my text description as you suggest above using the arrow drag and saving the view. However when I switch views the view will again show narrow on occasion. :(

0 Votes 0 ·

When you switch views, try to change List to Compact List in the view. Check if it works for you.

0 Votes 0 ·
matthowell-6829 avatar image
0 Votes"
matthowell-6829 answered

Changing widths by dragging the column doesn't seem to be persistent even if you save the view. Most likely this isn't designed correctly by Msft. Try adding a min-width to your JSON style block:
"min-width": "xxxpx"

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

TeresaCyrus-2583 avatar image
0 Votes"
TeresaCyrus-2583 answered

Great tip. Thanks.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LindaMackintosh-2886 avatar image
0 Votes"
LindaMackintosh-2886 answered

Thank you matthowell-6829 sorry very new to this coding. Do I just add your code before the last }} ? I tried this and it said invalid code. Thank you so much.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

matthowell-6829 avatar image
0 Votes"
matthowell-6829 answered LindaMackintosh-2886 commented

@LindaMackintosh-2886 It has to go within the style block so here:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"white-space": "normal",
"padding": "11px 0",
"min-width": "xxxpx"
},
"attributes": {
"class": "ms-fontColor-themePrimary"
}
}
Or unencoded which is easier to understand
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"white-space": "normal",
"padding": "11px 0",
"min-width": "xxxpx"
},
"attributes": {
"class": "ms-fontColor-themePrimary"
}
}

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.