VinayBa

Mouse event and rest service

Discussion created by VinayBa on Aug 22, 2013
Latest reply on Aug 23, 2013 by svakil-esristaff
HI All,

  I saw this sample http://developers.arcgis.com/en/javascript/sandbox/sandbox.html?sample=fl_hover

  here population is displayed when we mouse hover a south calorina state, if i want to display something onclick , then its not happening , please help me understand this.i added following code but still no help.

 require(["dojo/on", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "dojo/_base/Color", "esri/graphic"], function(on, SimpleFillSymbol, SimpleLineSymbol, Color, Graphic) {
                    on(southCarolinaCounties, "click", function(evt) {
                        alert("graphics");
                        // clears current selection
                       
                        
                        // create new graphic with selected graphic's geometry
                        var graphic = new Graphic(evt.graphic.geometry);
                        
                        // create a new symbol for the graphic
                        var sfs = new SimpleFillSymbol(SimpleFillSymbol.STYLE_FORWARD_DIAGONAL, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 2), new Color([255, 255, 0, 0.5]));
                        
                        // add symbol to the graphic
                        graphic.setSymbol(sfs);     
                        
                        // add the graphic to the map   
                        map.graphics.add(graphic);
                    });
                });


Do it depend on rest service that we are using whether we can add onclick funtionality or how does mous event work .Please guide.

Outcomes