AnsweredAssumed Answered

info window gets stuck

Question asked by jpacosta on Mar 6, 2013
Latest reply on Mar 7, 2013 by evtguy
I used the sample code "featurelayer hover", but instead of polygon features I use line features. The info window gets hung up when you go from feature to feature, and there seems to be a delay with the highlighting symbol. My app just doesnt run as well as the sample code and I have no idea where to start or how to troubleshoot the issue. I'm sure its something symbol and I just lack the experience. Here's the link so you can see my issue.... http://50.18.218.190/trafficStatus/index.html

and here's my version from the sample code.

<!DOCTYPE html> <html>   <head>     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">     <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9">     <!--The viewport meta tag is used to improve the presentation and behavior of the samples        on iOS devices-->     <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">     <title>Carlsbad Traffic Conditions</title>      <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/claro/claro.css">     <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css">     <style>       html, body, #mapDiv {         padding:0;         margin:0;         height:100%;       }     </style>      <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/"></script>     <script>       dojo.require("esri.map");       dojo.require("esri.layers.FeatureLayer");       dojo.require("dijit.TooltipDialog");       dojo.require("dojo.number");    //add Bing map    //dojo.require("esri.virtualearth.VETiledLayer");              var map, dialog;        function init(){       //function init() {         //map = new esri.Map("mapDiv", {           //basemap: "streets",           //center: [-80.94, 33.646],           //zoom: 8         //});          var initExtent = new esri.geometry.Extent({"xmin":-13068974.11,"ymin":3909008.57,"xmax":-13051775.78,"ymax":3920474.13,"spatialReference":{"wkid":102100}});                    map = new esri.Map("mapDiv",{            extent:initExtent         });           //Add the topographic layer to the map. View the ArcGIS Online site for services http://arcgisonline/home/search.html?t=content&f=typekeywords:service              var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");          map.addLayer(basemap);          //Create Bing map to add to map               var dynamicTraffic = new esri.layers.ArcGISDynamicMapServiceLayer("http://50.18.218.190/arcgis/rest/services/publicAGS/trafficStatus/MapServer");          map.addLayer(dynamicTraffic);                  var carlsbadTraffic = new esri.layers.FeatureLayer("http://50.18.218.190/arcgis/rest/services/publicAGS/trafficStatus/MapServer/0", {           mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,           outFields: ["*"]      });              //southCarolinaCounties.setDefinitionExpression("EndDate > = GETDATE()");          //var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,255,255,0.35]), 1),new dojo.Color([125,125,125,0.35]));     var symbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new dojo.Color([125,125,125,0.1]));         carlsbadTraffic.setRenderer(new esri.renderer.SimpleRenderer(symbol));         map.addLayer(carlsbadTraffic);          map.infoWindow.resize(245,125);                  dialog = new dijit.TooltipDialog({           id: "tooltipDialog",           style: "position: absolute; width: 260px; font: normal normal normal 10pt Helvetica;z-index:100"         });         dialog.startup();                  var highlightSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0,1]),3);          //close the dialog when the mouse leaves the highlight graphic         dojo.connect(map, "onLoad", function(){           map.graphics.enableMouseEvents();           dojo.connect(map.graphics,"onMouseOut",closeDialog);                 });                          //listen for when the onMouseOver event fires on the countiesGraphicsLayer         //when fired, create a new graphic with the geometry from the event.graphic and add it to the maps graphics layer         dojo.connect(carlsbadTraffic, "onMouseOver", function(evt) {           var t = "<b>${ProjectName}</b><hr><b>Road: </b>${Road}<br/>"                              + "<b>Start: </b>${StartDate:DateFormat}<br/>"                              + "<b>End: </b>${EndDate:DateFormat}<br/>"                              + "<b>Phone: </b>${ContactPhone}<br/>"    + "<b>Email: </b>${ContactEmail}<br/>"    + "<b>Traffic Impact: </b>${TrafficImpact}<br/>"         + "<b>Type: </b>${Type}<br/>"                        + "<b>Addl Info: </b>${AddlInfo}<br/>";             var content = esri.substitute(evt.graphic.attributes,t);           var highlightGraphic = new esri.Graphic(evt.graphic.geometry,highlightSymbol);           map.graphics.add(highlightGraphic);                      dialog.setContent(content);            dojo.style(dialog.domNode, "opacity", 0.85);           dijit.popup.open({popup: dialog, x:evt.pageX,y:evt.pageY});         });       }            function closeDialog() {         map.graphics.clear();         dijit.popup.close(dialog);       }        dojo.ready(init);     </script>   </head>   <body class="claro">     <div id="mapDiv"></div>   </body> </html>

Outcomes