Forum Discussion

CH4646's avatar
CH4646
Copper Contributor
May 31, 2024
Solved

Wrap single line text in the Title Column so that it breaks while maintaining hover/single click.

MarkBAndR was very helpful in another thread, and recommended I add this here.   I have a Sharepoint List (in List view) being fed from a Microsoft Form. The List has a PowerApp that opens to show ...
  • MarkBAndR's avatar
    May 31, 2024

    Hi CH4646 

     

    You need to add:

      "customRowAction": {
        "action": "defaultClick"
      }

    https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/formatting-syntax-reference#customrowaction

     

    If you like the JSON you currently have, it would become:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "div",
      "style": {
        "box-sizing": "border-box",
        "padding": "0 2px",
        "overflow": "hidden",
        "text-overflow": "ellipsis"
      },
      "attributes": {
        "class": "sp-field-fontSizeMedium"
      },
      "txtContent": "[$Title]",
      "customRowAction": {
        "action": "defaultClick"
      }
    }

    If you want it to look just like standard SharePoint, then you would use:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "button",
      "style": {
        "box-sizing": "border-box",
        "padding": "0 2px",
        "overflow": "hidden",
        "text-overflow": "ellipsis"
      },
      "attributes": {
        "class": "ms-Link root_137a7565 nameField_c45bee6b clickable_c45bee6b  "
      },
      "txtContent": "[$Title]",
      "customRowAction": {
        "action": "defaultClick"
      }
    }

    That has all the same formatting in the "class"

     

    -Mark

Resources