function showCEResults(featureSet) { // Clear Datagrid //create an empty store and then bind to grid var emptyCells = { items: "" }; var emptyStore = new dojo.data.ItemFileWriteStore({data: emptyCells}); grid = dijit.byId('gridCE'); grid.setStore(emptyStore); //alert ("Found InfoTemplate"); //Popup window settings var content = "<b>FID</b>: ${FID}" + "<br><b>MALLID</b>: ${MALLID}" + "<br><b>Mall Grade</b>: ${MALL_GRADE}" + "<br><b>District</b>: ${DISTRICT}" + "<br><b>MALL NAME</b>: ${MALLNAME}"; var infoTemplate = new esri.InfoTemplate("${DIVISIONNA}", content); var symbol = new esri.symbol.SimpleMarkerSymbol({ "color": [120,120,120,255], "size": 8, "type": "esriSMS", "style": "esriSMSSquare", "outline": { "color": [0,0,0,255], "width": 2, "type": "esriSLS", "style": "esriSLSSolid" }}); var symbolRedShinyPin = new esri.symbol.PictureMarkerSymbol({ "angle": 0, "xoffset": 0, "yoffset": 12, "type": "esriPMS", "url": "http://static.arcgis.com/images/Symbols/Basic/RedShinyPin.png", "contentType": "image/png", "width": 18, "height": 18 }); var symbolShinyPin = new esri.symbol.PictureMarkerSymbol({ "angle": 0, "xoffset": 0, "yoffset": 12, "type": "esriPMS", "url": "http://static.arcgis.com/images/Symbols/Basic/ShinyPin.png", "contentType": "image/png", "width": 18, "height": 18 }); //alert ("Found DataGrid and Graphics"); var dataForGrid = []; var temp = ""; var varRetailer = ""; //remove all graphics on the maps graphics layer otherRetailerLayer = new esri.layers.GraphicsLayer(); otherRetailerLayer.id = 'otherRetailers'; map.addLayer(otherRetailerLayer); //map.graphics.clear(otherRetailerLayer); //Performance enhancer - assign featureSet array to a single variable. var resultFeatures = featureSet.features; //Loop through each feature returned for (var i=0, il=resultFeatures.length; i<il; i++) { //Get the current feature from the featureSet. //Feature is a graphic var graphic = resultFeatures; varRetailer = resultFeatures.attributes.RETAILERID; if (varRetailer == "3000"){ resultFeatures.setSymbol(symbolRedShinyPin ); } else { resultFeatures.setSymbol(symbolShinyPin); } resultFeatures.setInfoTemplate(infoTemplate); otherRetailerLayer.add(resultFeatures); //Put values in array for datagrid var attValues = resultFeatures.attributes; dataForGrid.push(attValues); }; //var grid = registry.byId("gridCE"); var data = { identifier : "FID", label : "FID", items : dataForGrid }; var store = new dojo.data.ItemFileReadStore({data: data}); grid.setSortIndex(2,"true"); //sort on the state name grid.setStore(store); grid.on("rowclick", onRowClickHandler); //window.map.centerAndZoom(graphic.geometry); }
Solved! Go to Solution.
otherRetailerLayer.clear();
resultFeatures.setInfoTemplate(infoTemplate); map.graphics.add(resultFeatures);
map.graphics.clear();