I am pretty sure I replicated your example. For some reason, my layers are not showing up. Any help would be appreciated! Here is the code:
var findTask, findParams;
var map, center, zoom;
var grid, store;
var highlightMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 22,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
new Color([255,255,0]), 2),new Color([255,255,0,0.5]));
var highlightFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
new Color([255,200,0]), 2), new Color([255,255,0,0.50]));
var popup = new Popup({
titleInBody: false,
fillSymbol: highlightFillSymbol,
markerSymbol: highlightMarkerSymbol
}, domConstruct.create("div"));
parser.parse();
center = [-69, 45.5];
zoom = 6;
map = new esri.Map("map", {
basemap : "topo",
center : center,
zoom : zoom,
infoWindow : popup
});
var scalebar = new Scalebar({
map: map,
scalebarUnit: "dual"
});
var home = new HomeButton({
map: map
}, "HomeButton");
home.startup();
map.on("load", function() {
findParams = new FindParameters();
findParams.returnGeometry = true;
findParams.layerIds = [0];
findParams.searchFields = ["ORG_NAME"];
findParams.outSpatialReference = map.spatialReference;
findParams2 = new FindParameters();
findParams2.returnGeometry = true;
findParams2.layerIds = [0];
findParams2.searchFields = ["org_name"];
findParams2.outSpatialReference = map.spatialReference;
findParams3 = new FindParameters();
findParams3.returnGeometry = true;
findParams3.layerIds = [0];
findParams3.searchFields = ["org_name"];
findParams3.outSpatialReference = map.spatialReference;
findParams4 = new FindParameters();
findParams4.returnGeometry = true;
findParams4.layerIds = [0];
findParams4.searchFields = ["org_name"];
findParams4.outSpatialReference = map.spatialReference;
});
function doFind() {
findParams.searchText = dom.byId("processorName").value;
findTask.execute(findParams, showResults);
}
function doFind2() {
findParams2.searchText = dom.byId("specialtyName").value;
findTask2.execute(findParams2, showResults);
}
function doFind3() {
findParams3.searchText = dom.byId("buyingclubName").value;
findTask3.execute(findParams3, showResults);
}
function doFind4() {
findParams4.searchText = dom.byId("farmName").value;
findTask4.execute(findParams4, showResults);
}
registry.byId("search").on("click", doFind);
registry.byId("search2").on("click", doFind2);
registry.byId("search3").on("click", doFind3);
registry.byId("search4").on("click", doFind4);
domClass.add(map.infoWindow.domNode, "myTheme");
var template = new InfoTemplate();
infoTemplate.setTitle("<b>${ORG_NAME}</b>");
infoTemplate.setContent( "${ADDRESS}<br/>"
+ "${CITY_TOWN}, ${STATE}<br/>"
+ "Phone: ${PHONE}"
);
var template2 = new InfoTemplate();
infoTemplate.setTitle("<b>${org_name}</b>");
infoTemplate.setContent( "${address}<br/>"
+ "${city_town}, ${state}<br/>"
+ "Phone: ${phone}"
);
var template3 = new InfoTemplate();
infoTemplate.setTitle("<b>${org_name}</b>");
infoTemplate.setContent( "${address}<br/>"
+ "${city_town}, ${state}<br/>"
+ "Phone: ${phone}"
);
var template4 = new InfoTemplate();
infoTemplate.setTitle("<b>${org_name}</b>");
infoTemplate.setContent( "${address}<br/>"
+ "${city_town}, ${state}<br/>"
+ "Phone: ${phone}"
);
var featureLayer = new FeatureLayer("http://ummgis.umm.maine.edu:6080/arcgis/rest/services/testing/ProcessorsGIS428/MapServer/0",{
mode: FeatureLayer.MODE_SNAPSHOT,
id: "featureLayer",
outFields: ["*"],
infoTemplate: template
});
var query = new Query();
query.where = "1=1";
featureLayer.queryFeatures(query, function(featureSet) {
var nameList = [];
dojo.map(featureSet.features, function(feature) {
nameList.push(feature.attributes.ORG_NAME);
});
arrayUtils.forEach(nameList, function(feature){
registry.byId("processorName").get('store').add({ name: feature});
})
});
findTask = new FindTask("http://ummgis.umm.maine.edu:6080/arcgis/rest/services/testing/ProcessorsGIS428/MapServer");
var featureLayer2 = new FeatureLayer("http://ummgis.umm.maine.edu:6080/arcgis/rest/services/testing/SpecFoodProdGIS428/MapServer/0",{
mode: FeatureLayer.MODE_SNAPSHOT,
id: "featureLayer2",
outFields: ["*"],
infoTemplate: template2
});
var query2 = new Query();
query2.where = "1=1";
featureLayer2.queryFeatures(query, function(featureSet) {
var nameList2 = [];
dojo.map(featureSet.features, function(feature) {
nameList2.push(feature.attributes.org_name);
});
arrayUtils.forEach(nameList2, function(feature){
registry.byId("specialtyName").get('store').add({ name: feature});
})
});
findTask2 = new FindTask("http://ummgis.umm.maine.edu:6080/arcgis/rest/services/testing/SpecFoodProdGIS428/MapServer");
var featureLayer3 = new FeatureLayer("http://ummgis.umm.maine.edu:6080/arcgis/rest/services/testing/BuyingClubsGIS428/MapServer/0",{
mode: FeatureLayer.MODE_SNAPSHOT,
id: "featureLayer3",
outFields: ["*"],
infoTemplate: template3
});
var query3 = new Query();
query3.where = "1=1";
featureLayer3.queryFeatures(query, function(featureSet) {
var nameList3 = [];
dojo.map(featureSet.features, function(feature) {
nameList3.push(feature.attributes.org_name);
});
arrayUtils.forEach(nameList3, function(feature){
registry.byId("buyingclubName").get('store').add({ name: feature});
})
});
findTask3 = new FindTask("http://ummgis.umm.maine.edu:6080/arcgis/rest/services/testing/BuyingClubsGIS428/MapServer");
var featureLayer4 = new FeatureLayer("http://ummgis.umm.maine.edu:6080/arcgis/rest/services/testing/FarmsGIS428/MapServer/0",{
mode: FeatureLayer.MODE_SNAPSHOT,
id: "featureLayer4",
outFields: ["*"],
infoTemplate: template4
});
var query4 = new Query();
query4.where = "1=1";
featureLayer4.queryFeatures(query, function(featureSet) {
var nameList4 = [];
dojo.map(featureSet.features, function(feature) {
nameList4.push(feature.attributes.org_name);
});
arrayUtils.forEach(nameList4, function(feature){
registry.byId("farmName").get('store').add({ name: feature});
})
});
findTask4 = new FindTask("http://ummgis.umm.maine.edu:6080/arcgis/rest/services/testing/FarmsGIS428/MapServer");
map.on("layers-add-result", function (evt) {
var layerInfo = arrayUtils.map(evt.layers, function (layer, index) {
return {layer:layer.layer, title:layer.layer.name};
});
if (layerInfo.length > 0) {
var legendDijit = new Legend({
map: map,
layerInfos: layerInfo
}, "legendDiv");
legendDijit.startup();
}
});
map.addLayers([featureLayer, featureLayer2, featureLayer3, featureLayer4]);
function showResults(results) {
map.graphics.clear();
console.log(results);
var symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 15,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_NULL, new Color([255, 0, 0, 1]), 1), new Color([255, 0, 0, 1])
);
var items = arrayUtils.map(results, function(result) {
var graphic = result.feature;
graphic.setSymbol(symbol);
map.graphics.add(graphic);
return result.feature.attributes;
});
var data = {
identifier : "Name",
label : "Name",
items : items
};
store = new ItemFileReadStore({
data : data
});
var grid = registry.byId("grid");
grid.setStore(store);
grid.on("rowclick", onRowClickHandler);
map.centerAndZoom(center, zoom);
}
function onRowClickHandler(evt) {
var clickedOrgName = evt.grid.getItem(evt.rowIndex).ORG_NAME;
var selectedOrgName = arrayUtils.filter(map.graphics.graphics, function(graphic) {
return ((graphic.attributes) && graphic.attributes.ORG_NAME === clickedOrgName);
});
if (selectedOrgName.length) {
var center = [selectedOrgName[0].geometry.getLongitude(), selectedOrgName[0].geometry.getLatitude()];
var zoom = 15;
map.centerAndZoom(center, zoom);
}
}
});