Question

I want to format a view using JSON but stil keep the possibility to click on the title and get the information panel to edit the item. Using the following code, I cannot longer click on the title.

"elmType": "span", "txtContent": "=[$Title]"

Was it helpful?

Solution

enter image description hereI'm seeing that when formatting [Title] column, it looses its single-click action behavior. However, double-click on the formatted [Title] column opens the item in view/edit mode.

Here's the JSON to format [Title] column itself

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "span",
  "txtContent": "@currentField",
  "style": {
    "color": "blue",
    "font-size": "1.5em"
  }
}

You can use a button action in another column and still keep the single-click behavior, same a the [Title] column

Here is the JSON for that. Also, note that the button's styles have been updated to make it look like [Title] column

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "[$Title]",
  "customRowAction": {
    "action": "editProps"
  },
  "style": {
    "background-color": "Transparent",
    "background-repeat": "no-repeat",
    "border": "none",
    "cursor": "pointer",
    "overflow": "hidden",
    "outline": "none"
  }
}

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top