A Person
column, with no column formatting, has the desired functionality.
I.e. when you hover over a person's name, you can see their Person
card etc.
So the starting state of the column formatting is:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json"
}
Then I add additional column formatting, with an if
condition.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=if([$Current_x0020_Assignment] =='', 'Not assigned', [$Current_x0020_Assignment.title])"
}
The logic above is saying:
When the value of the
Current Assignment
column is blank, add the textNot assigned
,
otherwise, show the the Person's name.
What happens is that the text displays correctly, but I lose the 'hover' functionality that displays the Person
card etc.
If I try referencing @currentField
:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=if([$Current_x0020_Assignment] =='', 'Not assigned', @currentField)"
}
or [$Current_x0020_Assignment]
:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=if([$Current_x0020_Assignment] =='', 'Not assigned', [$Current_x0020_Assignment])"
}
The Person
column just displays [Object Object]
.
Is there a way to apply the desired conditional logic whilst retaining the hover
functionality when hovering over the Person's name?