function getTextContent(graphic) { //continuation of popup feature var bldg = "<br /><br />Shelter: " +graphic.attributes.SHELTER + "<br /><br />Shelter Room: " +graphic.attributes.LOCATION; //fields, within the featureLayer, to return information for return bldg; }Or, another idea, is how to simply have it always query the top-most layer attributes? I think that would solve my problem as well.
Solved! Go to Solution.
FeatureLayer variable name
//the layer itself var layer = graphic.getLayer(); //the layer's id var layerId = graphic.getLayer().id;
function getTextContent(graphic) { if (graphic.getLayer().id === 'feature_layer_one') { //do stuff } else if (graphic.getLayer().id === 'feature_layer_two') { //do stuff } }
var fl = new esri.layers.FeatureLayer(url, { mode: 1, id: 'feature_layer_one' });
function getTextContent(graphic) { if (graphic.attributes.SHELTER === undefined) { //do stuff } else { //do stuff } }
function getTextContent(graphic) { //continuation of popup feature if (graphic.attributes.SHELTER === undefined) { var bldg = "<br /><br />BUILDING: " +graphic.attributes.BUILDING; //fields, within the featureLayer, to return information for return bldg; } else { var bldg2 = "<br /><br />BUILDING: " +graphic.attributes.SHELTER + "<br /><br />Shelter Room: " +graphic.attributes.LOCATION; return bldg2; } }But, would also rather force the popup to auto navigate to the second record of the selected feature if SHELTER is undefined, in addition to displaying the attributes of the variable "bldg2" above. Is there a code snippet to navigate to the next record in an infotemplate popup?
FeatureLayer variable name
//the layer itself var layer = graphic.getLayer(); //the layer's id var layerId = graphic.getLayer().id;
function getTextContent(graphic) { if (graphic.getLayer().id === 'feature_layer_one') { //do stuff } else if (graphic.getLayer().id === 'feature_layer_two') { //do stuff } }
var fl = new esri.layers.FeatureLayer(url, { mode: 1, id: 'feature_layer_one' });
As in the layer itself or any of the layer's properties, functions, etc?Thats even better, Ben, but I still need to somehow have it navigate to attributes of 'feature_layer_one' first if it exists where clicked, and if non-existent, then navigate to 'feature_layer_two', as well, somewhere in the if statement that I have now (below).//the layer itself var layer = graphic.getLayer(); //the layer's id var layerId = graphic.getLayer().id;function getTextContent(graphic) { if (graphic.getLayer().id === 'feature_layer_one') { //do stuff } else if (graphic.getLayer().id === 'feature_layer_two') { //do stuff } }You would need to set the feature layer's id on creation.var fl = new esri.layers.FeatureLayer(url, { mode: 1, id: 'feature_layer_one' });
function getTextContent(graphic) { //continuation of popup feature if (graphic.getLayer().id === 'fl') { var bldg = "<br /><br />BUILDING: " +graphic.attributes.SHELTER + "<br /><br />Shelter Room: " +graphic.attributes.LOCATION; //fields, within the featureLayer, to return information for return bldg; } else if (graphic.getLayer().id === 'fl2') { var bldg = "<br /><br />BUILDING: " +graphic.attributes.BUILDING; //fields, within the featureLayer, to return information for return bldg; } }
Is there a reason you don't just set the infoTemplate of the feature layer?
Is there a code snippet to navigate to the next record in an infotemplate popup?