Hello!
I´m going to explain question a bit further.
I made a side bar where I´m showing all my content from pop up (which is turned off). We chose few of attributes we want to show within the sidebar, but the problem is that not all features have values under all those attributes, so now they are just shown as empty.
Bigger problem are the links, since we have 2 attributes showing links to external documents (with clickable text "More info").
Now, no matter if there is a link in the table for that feature or not, both link attributes are shown, both with clickable text, from which only one is right or none (as some don´t have any external links).
I would like a solution where I can write in the code, if attribute is without value not to be shown, those ones with values to be shown. I´ve tried with different combinations of IF ELSE, but didn´t work, I just lack experience.
Here´s the part of the code with attributes in JS:
var other = new InfoTemplate("", // OTHER ATTRIBUTES " <b>Name</b>:<br> ${Name}" + "<br>" + "<br>" + " <b>Map layer</b>:<br> ${Map_layer}"+ "<br>" + "<br>" + " <b>Classification</b>:<br> ${Classification}"+ "<br>" + "<br>" + " <b>Assesment</b>:<br> ${Assesment}" + "<br>" + "<br>" + " <b>Justification</b>:<br> ${Justification}" + "<br>" + "<br>" + " <b>Link</b>:<br> <a href=${Link} target=_blank>More info</a>" + "<br>" + "<br>" + " <b>Link2</b>:<br> <a href=${Link2} target=_blank>More info</a>" + "<br>" + "<br>" + " <b>Contact person</b>:<br> ${Contact_person}" );
Help is much appreciated! Thanks!
Nedim,
I think you may get attribute values using IdentifyTask. When you execute the IdentifyTask, you will get results if there is any feature on map . Then you can check your attribute values are empty or not.
For example,
var feature = result.feature;
if(feature.attributes["Link"] === Null);
See this sample Display identify results in popup | ArcGIS API for JavaScript
Nedim,
I would look into using the infoTemplates setContentmethod then as you can manipulate the data and define what is to be shown in the pop-up before it is shown. There are sveral examples of using this method if you search for setContent.
I´ll study it a bit closer one of these days and see how it´ll go for me.
Thanks to both!