I'm stuck on a particular scenario right now because of a recent change by Microsoft in Office 365 regarding the "Multiple lines of text" column in a Sharepoint list.
My main goal is to truncate this column. If this column will have a lot of characters in it, it'll eat up the display page because it can have up to 60k characters.
I'm looking to limit the rows of this column on the list page into like 5rows only and then add a see more button if possible?
I've found this article about formatting a column in sharepoint list using JSON. https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting
I've seen that you can put the column into a div using this script but I'm just wondering if I'll be able to limit the rows of this column using JSON?
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField" }
SharePoint list View formatting only allows a subset of css. Notice that there are no styles with "-webkit-" prefix. Refer to the documentation here - https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#style
View formatting expressions should be enough. You'll have to ensure that the Multi-line field is configured as a plain text or rich but not enhanced (View formatting doesn't support this yet). I have used the below expression against Multi-line plain text field.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=substring(@currentField, 0, 140) + '...'"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With