We have had a standard bit of JSON code working for a long time on our SharePoint Intranet, I just discovered today (possibly its been an issue for a while, when I asked some users), that the textContent field of a Hyperlink in the JSON code is not rendering in the newer SharePoint list webpart in SharePoint online.
The hyperlink still works (it renders a field named Link, that has the URL, the field named Title has the text label, and a field named Description contains the tool tip for the hyperlink). They can hover the mouse over the Link column on the ASPX web page in SharePoint, and they will see the URL at the bottom of the browser, and the tooltip, but the Hyperlink renders / appears as a blank cell.
Blank hyperlink in the Webpart, Tooltip showing, Tooltip / Description field, also rendered as a standard column next to the hyperlink, so you can see that it does render plain text fields fine in the Webpart.
Does anyone know how to work around this bug that MS seem to have introduced? Any idea when it will be fixed?
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"txtContent": "=if(@currentField == '', '** No URL Specified **', [$Title])",
"style": {
"font-size": "11pt",
"white-space": "nowrap"
},
"attributes": {
"href": "@currentField",
"target": "=if(indexOf([$Title], '(Link)' )>0, '_blank','_self')",
"title": "[$Description]",
"class": ""
}
}