Forum Discussion

ohalev's avatar
ohalev
Copper Contributor
Feb 07, 2021

JSON Column formatting not updated in Quick Edit mode

I have applied a custom JSON formatting to several SharePoint online columns (new experience).
I’m using JSON formatting in a couple of people picker columns with multiple selections enabled, so that the formatting will alert the user in Quick Edit mode if they selected more than one name (I had to leave Allow Multiple Selections as “Yes” for these fields for other requirements).
If the name count is grater than 1, the field/column gets a flashy red formatting and an error text.
It all works great for all fields, and the below JSON column formatting is applied to the columns in views and on display form in the Details Pane. It also works well in the full page Display Form (DispForm.aspx ?ID=XX) except for one multi people picker that does not change the formatting when the user changes the value:

In the screen recording below you can see the same scenario applied to two different columns on the same list, both columns have the exact same JSON formatting:

  1. User clicks a direct link to the list item display form DispForm.aspx?ID=XX
  2. Quick Edit is enabled for this list
  3. Both the “HRM” and the “GM Staff” fields have the exact same JSON formatting as below
  4. Both fields have more than one person name prepopulated and the JSON formatting is applied as expected
  5. When the user edits the “HRM” field in Quick Edit , removes two names, leaves just one name and waits for save, the displayed value and the custom formatting are updated as expected.
  6. BUT, when the user edits the “GM Staff” field in Quick Edit , removes two names, leaves just one name and waits for save, the displayed value and the custom formatting are NOT updated and the formatting still suggests there are multiple names, but another click to edit shows there’s only one name. even when the user clears all names and leaves the field empty, the formatting is not updated.
  7. Refreshing the page fixes the issue and the correct formatting is applied.

 

Any idea why one field would reflect a change in value in quick edit mode, and another field (of the exact same type, configuration and formatting) would not?

Here's the JSON formatting I use for both fields:

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "style": {
    "box-sizing": "border-box",
    "padding": "0 2px",
    "border": "=if(length(@currentField)>1,'5px dashed red','none')"
  },
  "children": [
    {
      "elmType": "span",
      "style": {
        "color": "red",
        "font-size": "20px"
      },
      "attributes": {
        "iconName": "=if(length(@currentField)>1,'Error','')"
      }
    },
    {
      "elmType": "span",
      "style": {
        "color": "=if(length(@currentField)>1,'Red','')"
      },
      "txtContent": "=if(length(@currentField)>1,'Please Select Just One Approver!\n\n'+@currentField.title,@currentField.title)"
    }
  ]
}

 

No RepliesBe the first to reply

Resources