var graphicsTemplate = new esri.InfoTemplate(); graphicsTemplate.setTitle('Custom Project'); graphicsTemplate.setContent(graphicsLayerContent); //Define the Graphics Layer which contains the user drawn "projects" theGLayer = new esri.layers.GraphicsLayer({ id: "gLayer", opacity:0.80, visible:true }); theGLayer.setInfoTemplate(graphicsTemplate); map.addLayer(theGLayer);
function addGraphic(evt) { //deactivate the toolbar and clear existing graphics tb.deactivate(); map.enableMapNavigation(); theGLayer.clear(); //map.graphics.clear(); // figure out which symbol to use var symbol, g; if ( evt.type === "point" || evt.type === "multipoint") { symbol = markerSymbol; } else if ( evt.type === "line" || evt.type === "polyline") { symbol = lineSymbol; } else { symbol = fillSymbol; } attributes = {"ProjTitle": dojo.attr("intPrjName","value"),"projLimits": dojo.attr("intPrjLimits","value")}; g = new esri.Graphic(evt, symbol, attributes, null); theGLayer.add(new esri.Graphic(g)); //map.graphics.add(new esri.Graphic(evt, symbol)); }
Solved! Go to Solution.
function addGraphic(evt)
theGLayer.add(new esri.Graphic(g)); //map.graphics.add(new esri.Graphic(evt, symbol));
theGLayer.add(g);
function addGraphic(evt)
theGLayer.add(new esri.Graphic(g)); //map.graphics.add(new esri.Graphic(evt, symbol));
theGLayer.add(g);