Forum Discussion

Pavel2235's avatar
Pavel2235
Brass Contributor
Nov 21, 2023

JSON formatting breaks grid view

Hi!
I have a list with all my users data. 
When I try to edit some items in Grid view, I notice that it is broken. 
One of my user doesn't have Work phone number in the field Work Mobile Number.

 


This field has a Person or Group type and show field as Work phone.

 


Additionally, I have added JSON formatting to this column.

{
  "$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-css-backgroundColor-BgMintGreen sp-css-borderColor-MintGreenFont sp-css-color-MintGreenFont sp-field-bold"
  },
  "txtContent": "[$Work_x0020_Mobile_x0020_Number.title]",
  "defaultHoverField": "[$Work_x0020_Mobile_x0020_Number]"
}

I tried to remove JSON from this column and it worked.
It’s strange why if there is no data in this field, JSON breaks it.
And I don't know how to fix it without removing JSON. 

No RepliesBe the first to reply

Resources