I'm trying to truncate the Sharepoint list view for multi text columns but not have it truncate the column/field in the list item when opened for viewing.

Lgoodman001 25 Reputation points
2024-08-27T13:32:36.3833333+00:00

I used this JSON code below in each column I wanted truncated, and it worked; however, now I can't see the full text when opening the item for review. Thanks in advance for your help.

JSon TruncateSP list view

SP List item

Header 1Header 2Cell 1Cell 2Cell 3Cell 4

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,199 questions
{count} vote

Accepted answer
  1. Yanli Jiang - MSFT 28,956 Reputation points Microsoft Vendor
    2024-08-28T07:53:09.8733333+00:00

    Hi @Lgoodman001 ,

    I tested it and got the same results as you, this is by design.

    You can add a title attribute to the div element in the attribute properties, and when the user hovers over it, the full text will be displayed.

    Please try this:

    {
     "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    "elmType": "div",
    "txtContent": "=substring(@currentField, 0, 140) + '...'",
    "attributes": {
    "title": "@currentField"
     }
    }
    

    Hope this can help.


    If the answer is helpful, please click "Accept as Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.