I can get a general popup to work fine...just cant seem how to transition from WebMap to my Feature class in the example above. How to get the results to the side panelI can see the side panelI can see my featuresI can click a feature and get a popup But cant figure out how to add the below code snip to the FeatureLayer being added....map.infoWindow.set("popupWindow", false);
initializeSidebar(window.map);
I see the above in the WebMap from the example in last post.... var map;
require([
"dojo/ready", "dojo/on","dojo/_base/connect", "dojo/dom","dijit/registry","dojo/dom-construct","dojo/parser",
"esri/dijit/Popup","esri/dijit/PopupTemplate", "esri/layers/FeatureLayer",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/InfoTemplate",
"esri/renderers/UniqueValueRenderer", "esri/renderers/SimpleRenderer", "esri/symbols/SimpleMarkerSymbol","esri/symbols/SimpleLineSymbol",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "esri/map","esri/arcgis/utils","esri/domUtils","esri/dijit/Popup"
], function(
ready, on, connect,dom,registry,domConstruct,parser,
Popup,PopupTemplate, FeatureLayer,
ArcGISDynamicMapServiceLayer,
InfoTemplate,
UniqueValueRenderer,SimpleRenderer,SimpleMarkerSymbol,SimpleLineSymbol,
BorderContainer, ContentPane,Map,arcgisUtils,domUtils,Popup
) {
parser.parse();
//setup event handlers for the next/previous buttons
on(dom.byId("previous"), "click", selectPrevious);
on(dom.byId("next"), "click", selectNext);
map = new Map("mapDiv", {
basemap: "topo",
center: [-77.4329, 37.5410],
zoom: 7,
slider: true
});
var infoTemplate = new InfoTemplate();
infoTemplate.setTitle("Population in ${Species}");
infoTemplate.setContent("<b>2007 :D: </b>${Habitat}<br/>");
//map.on("load", initializeSidebar);
var featureLayer0 = new FeatureLayer("https://web1/arcgis/rest/services/Warbler_Map/Warbler_Map_Readonly/FeatureServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
infoTemplate: infoTemplate,
outFields: ['*']
});
map.addLayer(featureLayer0);
function initializeSidebar(map){
var popup = map.infoWindow;
//when the selection changes update the side panel to display the popup info for the
//currently selected feature.
connect.connect(popup, "onSelectionChange", function(){
displayPopupContent(popup.getSelectedFeature());
});
//when the selection is cleared remove the popup content from the side panel.
connect.connect(popup, "onClearFeatures", function(){
//dom.byId replaces dojo.byId
dom.byId("featureCount").innerHTML = "Click to select feature(s)";
//registry.byId replaces dijit.byId
registry.byId("leftPane").set("content", "");
domUtils.hide(dom.byId("pager"));
});
//When features are associated with the map's info window update the sidebar with the new content.
connect.connect(popup, "onSetFeatures", function(){
displayPopupContent(popup.getSelectedFeature());
dom.byId("featureCount").innerHTML = popup.features.length + " feature(s) selected";
//enable navigation if more than one feature is selected
popup.features.length > 1 ? domUtils.show(dom.byId("pager")) : domUtils.hide(dom.byId("pager"));
});
}
function displayPopupContent(feature){
if(feature){
var content = feature.getContent();
registry.byId("leftPane").set("content", content);
}
}
function selectPrevious(){
window.map.infoWindow.selectPrevious();
}
function selectNext(){
window.map.infoWindow.selectNext();
}
});