1

I have a list where the comments in Classic SP make it extend too much and in SPO the user has to click into it to see all of it (don't know how to get the 'see more', but don't think they would click on it, so I need to increase the height/width of just that column/row. I know JSON, a little, so if someone knows the command?

0

If you use Classic Experience, we can use JSLINK to achieve it, add the code below into a script editor web part in the list view page.

<script type="text/javascript">
(function () { 
    // Create object that have the context information about the field that we want to change it's output render  
    var fieldContext = {}; 
    fieldContext.Templates = {}; 
    fieldContext.Templates.Fields = { 
        // Apply the new rendering for Available field on List View 
        "_Comments": { "View": fieldTemplate } 
    }; 
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(fieldContext);
})(); 

// This function provides the rendering logic for list view 
function fieldTemplate(ctx) { 
    var fieldValue = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
    //This regex expression use to delete html tags from the Body field 
    var regex = /(<([^>]+)>)/ig;
    fieldValue = fieldValue.replace(regex, ""); 
    var newfieldValue = fieldValue; 
    if (fieldValue && fieldValue.length >= 100){ 
        newfieldValue = fieldValue.substring(0, 100) + " ..."; 
    } 
    return "<span title='" + fieldValue + "'>" + newfieldValue + "</span>"; 
}
</script>

Example: Substring long text

  • Thank you, but do you know the command in JSON vs. JSLINK/JS? Or am I missing something? – DavidnATL May 30 at 13:40
  • I know the JSON formatting, I this case, we can easy use JSLINK to achieve it. If you use modern list, we need use the JSON formatting to achieve it. – LZ_MSFT May 31 at 0:56
  • I am not using the Classic. I am using the O365. Do you have it the command for it? – DavidnATL May 31 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.