I noticed a change in popup behavior when I upgraded ArcGIS API from v4.6 to v4.7. I have a layer with images in popup template. Some features in that layer may not have an image, i.e. {Image} field empty.
In JSAPI v4.6, the popup will not show image when empty, as expected:
However, in JSAPI v4.7, the popup will show an empty image, which looks very weird:
Here is an running example:
https://codepen.io/anon/pen/YLzoZP
I'm wondering if this change is made on purpose or it's a bug in v4.7 API? Thanks.
Solved! Go to Solution.
Hi Justdoit011, Yes this looks to be a bug. I'll get an issue created. Are you able to work around it? At the very least have some kind of arcade expression that will show a "no image" image when there isn't a valid URL.
Hi Justdoit011, Yes this looks to be a bug. I'll get an issue created. Are you able to work around it? At the very least have some kind of arcade expression that will show a "no image" image when there isn't a valid URL.
Hi Matt,
Thank you for confirming this issue. Yes, I was able to work around it with Arcade expression. When the image url is empty, I just use a placeholder image instead. The bubble will look like below. It looks better than the empty image but not as good as fully hide the image area.
Here is the Arcade expression:
{
"popupInfo": {
"title": "{Name}",
"fieldInfos": [...],
"expressionInfos": [{
"name": "expr0",
"title": "ImageUrl",
"expression": "IIf(IsEmpty($feature.Thumbnail),'http://hazegazer.org/assets/image/img_not_available.png',$feature.Thumbnail)",
"returnType": "string"
}],
"mediaInfos": [{
"title": "Image",
"type": "image",
"value": {
"sourceURL": "{expression/expr0}",
"linkURL": "{Image}"
}
}]
}
}
It seems that the empty image issue has been fixed in JSAPI v4.8 release. You don't need to workaround it using Arcade expression anymore. Thanks.