AnsweredAssumed Answered

Why does fromArcGISServerUrl not support popups?

Question asked by travis.l.riffle on Mar 8, 2018
Latest reply on Mar 14, 2018 by rscheitlin

I can load a feature layer, but the popup data associated with the FeatureLayer does not work. 

I can load the same item by calling fromPortalItem and it has popups.  Is there a way to load a FeatureLayer by URL instead of ID that will allow popups??

 

Here's a code example of a FeatureLayer I created for a coffee shop in Phoenix.  If I query by id, the popup shows, but if I query by the service URL, the coffee shop shows but not the popup.

 

SANDBOX EXAMPLE
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>FeatureLayer - 4.6</title>

<link rel="stylesheet" href="https://js.arcgis.com/4.6/esri/css/main.css">
<script src="https://js.arcgis.com/4.6/"></script>

<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>

<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/Layer",
"esri/layers/FeatureLayer",
"esri/widgets/Popup",
"dojo/domReady!"
],
function(
Map, MapView, Layer,
FeatureLayer, Popup
) {

var map = new Map({
basemap: "hybrid"
});

var view = new MapView({
container: "viewDiv",
map: map,

extent: { // autocasts as new Extent()
xmin: -9177811,
ymin: 4247000,
xmax: -9176791,
ymax: 4247784,
spatialReference: 102100
}
});

/********************
* Add feature layer
********************/

// Carbon storage of trees in Warren Wilson College.
var featureLayer = new FeatureLayer({
url: "https://services5.arcgis.com/QGM0VeSNqhUanPGN/arcgis/rest/services/Coffee_Shops__Custom_Data_Sample/FeatureServer"
});

map.add(featureLayer);
});
</script>
</head>

<body>
<div id="viewDiv"></div>
</body>

</html>

Outcomes