JSAPI toggle field visibility in Popup based on field value?

2210
1
04-27-2015 10:18 AM
Highlighted
New Contributor II

I have a dataset with a lot of missing attribution.  As opposed to presenting the user with a popup that shows a bunch of empty values I'd like to toggle the visibility based on whether the particular field has a value.  so for instance for a given fieldname definition:

{fieldname: "DPTH_M", label: "Depth (meters): ", visible: true },

if DPTH_M was empty I would not want to display this in the popup.  Can visibility be toggled true or false based on this requirement?

Reply
0 Kudos
1 Reply
Highlighted
Esri Frequent Contributor

No not using the popup template but you can define a function that will be used to render the popup content. In the function you could then check for the presence of a value and add it to the popup.  Here's a link to an older sample that shows how this works:

Info window with chart | ArcGIS API for JavaScript

Reply
0 Kudos