Sep 01 2022 11:25 AM
Hi All,
Been scouring a while now looking for an answer. I've seen a lot of posts about this but cannot get anything to work. I am trying to get the 'new title' column to wrap the text so the entire title shows instead of being clipped.
I go to the list > format view > format columns > new title column and then advanced. But anything I try doesn't work.
I'm new to JSON so I know I'm screwing something up.
This is the last code that I tried that seemed to work for others
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"style":{
"white-space":"wrap"
},
"txtContent": "@currentField"
}
Thanks in advance,
Sep 01 2022 10:15 PM
@amccormack You need to use the view formatting instead of column formatting.
As you are using tile/gallery list view, you have to customize the "Gallery" view:
Follow documentation for more information: view-gallery-formatting
Similar thread for more information: (SP List) How to wrap a text in the format view?
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Sep 02 2022 08:44 AM
Aug 09 2023 03:04 PM
@amccormack did you ever figure it out? Having the exact same problem. Nothing works. The json editor keeps saying it’s not valid code and won’t even save in sharepoint online.
Mar 12 2024 02:58 PM
@bakline @amccormack I was able to get the title to wrap using a combo of white-space and word-break. I think what was key was placing the code below "txtContent."
"elmType": "p",
"attributes": {
"title": "[$Title]",
"class": "ms-fontColor-neutralPrimary sp-card-content sp-card-highlightedContent",
"role": "heading",
"aria-level": "3"
},
"txtContent": "=if ([$Title] == '', '–', [$Title])",
"style":{
"white-space": "wrap",
"word-break": "keep-all"}
Here is how this looks in practice: