Forum Discussion
Country column format
Hello community, I have a column with a custom format where the flag of a country and its name is shown, it was working fine and I don't know if it was updates or some problem with the application but it stopped working, I have reviewed the code and it is fine, I have I searched for information on this topic but I have not found it, please can you help me:
The json code is like this:
Thanks for your help, good luck
- DeletedBased on the JSON code you provided, it looks like the issue might be with the "inlineEditField" property. This property is used to enable inline editing of the column value directly in the list view, and it may not work as expected when used in combination with other column formatting properties.
To fix the issue, you can try removing the "inlineEditField" property from the JSON code and see if that resolves the problem. Here's an updated version of the JSON code without the "inlineEditField" property:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "img",
"attributes": {
"src": "=if(@currentField,('https://www.worldometers.info/img/flags/' + if(indexOf(@currentField,'Afganistán')==0,'af', if(indexOf(@currentField,'Albania')==0,'al',if(indexOf(@currentField,'Alemania')==0,'gm', if(indexOf(@currentField,'Argelia')==0,'ag', if(indexOf(@currentField,'Argentina')==0,'ar', if(indexOf(@currentField,'Andorra')==0,'an', if(indexOf(@currentField,'Antigua y Barbuda')==0,'ac',if(indexOf(@currentField,'Arabia Saudita')==0,'sa',if(indexOf(@currentField,'Zambia')==0,'za',if(indexOf(@currentField,'Zimbabue')==0,'zi','no'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) + '-flag.gif'),'')",
"title": ""
},
"style": {
"max-width": "23px",
"padding": "0 6px 0 0"
}
},
{
"elmType": "span",
"txtContent": "@currentField"
}
]
}
If the issue persists even after removing the "inlineEditField" property, you can try the following troubleshooting steps:
1. Check if the column containing the country names and flags is still using the correct JSON formatting code.
2. Verify that the country names in the column exactly match the country names used in the JSON code.
3. Check if there have been any recent changes to the SharePoint Online environment or updates to the list view that may have affected the column formatting.
If none of these steps resolve the issue, you may want to contact Microsoft Support for further assistance. - slyth27Copper Contributor
Have you able to solve this issue? I am facing the same issue as well which occured around the same time as yours. Please share if you are able to solve this.
Embed Images Stopped Displaying In Sharepoint List Column - Microsoft Q&A
There are also other users who is facing the same issue, so I think this has to be something related to SP update.
You can fix this issue by adding external site domain from where you are using images (in JSON) in HTML Field Security settings of your SharePoint site - Allow or restrict the ability to embed content on SharePoint pages
More information at: Hyperlink/Picture Column suddenly breaks external images in Gallery/Card Designer
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
slyth27 Sstein2310 I have tried it on our SharePoint site from my end and it is working fine.
Output:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.