Hi,
I have a Sharepoint List, with 2 colums as selection for countries. Using JSON, I am able to display flag images of each country (not all countries in the world) as shown below with the country name.
[
(Fig.1 Selection list with country flag and name)
After filling the form and adding a new item, everything worked well as shown below.[
(Fig. 2 List view with the flag image and name displaying)
We have been using this list for a few months, not editing any of the JSON code, when all the sudden the flag images stopped displaying as shown below.
[
(Fig. 3 List view with country name but flag image missing)
Country flags are linked to Flagpedia, and does work and display correctly when entered in browser. Strange thing is, when viewed in grid view or form, flag image does display correctly.
[
(Fig.4 GRID VIEW with the flag image and name displaying)
As mentioned above, no changes were made in the JSON code. The images just stopped showing all the sudden.
Any clues?
For your reference, below is the code for the above (which did worked normally in Fig.2). ※src is narrowed to only a few country flags, just for this reference.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "img",
"attributes": {
"src": "='https://flagcdn.com/w40/'+ if(@currentField == 'Argentina','ar',if(@currentField == 'Australia','au',if(@currentField == 'Austria','at',if(@currentField == 'Japan','jp',))))+'.png'",
"title": "=if(@currentField == 0,'','')"
}
},
{
"elmType": "span",
"txtContent": "@currentField",
"style": {
"padding-left": "6px",
"white-space": "nowrap",
"text-transform": "uppercase"
}
}
]
}