I am a newbi here with javascript. I am asking for some help with adding multiple featurelayers that connect to a legend, can be toggled on and off and all have popups. I am using this code but it doesn't seem to work with the legend and checkbox dijit. Any help would be greatly appreciated!
var popupTemplate = new esri.dijit.PopupTemplate({
title: "{Building} {Type}",
fieldInfos: [
{fieldName: "Building", visible: true, label:"Building Name:"},
{fieldName: "Descrip", visible:true, label:"Info:"},
],
mediaInfos: [
{
"type":"image",
"value":{
"sourceURL":"{Images}",
"linkURL":"{Hyperlink}"
}
}]
});
//create a feature layer based on the feature collection
var featureLayer = new esri.layers.FeatureLayer("http://webgis.uwm.edu/ArcGISUWM/rest/services/Sustain1/MapServer/0", {
mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
infoTemplate: popupTemplate,
outFields: ['Type','Building','Descrip','Images','Hyperlink']
});
featureLayer.setDefinitionExpression("Type != ''");
dojo.connect(featureLayer,"onClick",function(evt){
map.infoWindow.setFeatures([evt.graphic]);
});
map.addLayer(featureLayer);