POST
|
Alicia, did you ever get your code to work? I'm looking to accomplish the same thing...any help would be much appreciated. Thanks! Yes I did! The doIdentify functionality was key. Here's the code: function initFunctionality(map) { dojo.connect(map, "onClick", doIdentify); identifyTask = new esri.tasks.IdentifyTask("http://InputYourMapServerAddress"); identifyParams = new esri.tasks.IdentifyParameters(); identifyParams.tolerance = 8; identifyParams.returnGeometry = true; identifyParams.layerIds = [0]; identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL; identifyParams.width = map.width; identifyParams.height = map.height; } function doIdentify(evt) { map.graphics.clear(); identifyParams.geometry = evt.mapPoint; identifyParams.mapExtent = map.extent; identifyTask.execute(identifyParams, function(idResults) {openIdentifyLinkResult(idResults, evt); }); } function openIdentifyLinkResult(results){ if(results[0]){ var idResult = results[0]; if(idResult.feature.attributes.WEB){ window.open(idResult.feature.attributes.WEB); }} }
... View more
10-25-2013
09:20 AM
|
0
|
0
|
503
|
POST
|
You would need to register an event handler for the layer's click event. By providing this event handler, you override the default click behavior of opening the info window. Thank you for your help. I, however, being very new to dojo was unable to successfully accomplish this. Are you suggesting a simple edit to the event handler would accomplish my goal? I've edited my post to include the script, if you wouldn't mind taking a look.
... View more
07-03-2013
06:59 AM
|
0
|
0
|
503
|
POST
|
If I understand, after your identify ( Are you using an identify?) just don't call the map.infoWindow.show() and use window.open(.......) to open the url contained in your attribute... I'm not using identify but I appreciate the suggestion! I'm going put up my script for review.
... View more
07-03-2013
06:43 AM
|
0
|
0
|
503
|
POST
|
Is there a way to bypass the infowindow and go directly to a hyperlink (via an attribute containing a web address) by clicking on a feature? Or, to put it another way... Right now my script is setup for an info window, but instead of pulling up the infowindow upon clicking a feature, I want to go straight to a webpage. How could I accomplish this? EDIT 2013/07/03: <!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, IE=10" > <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/> <title> </title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/esri/css/esri.css"> <style> html, body, #mapDiv { height: 100%; margin: 0; padding: 0; } </style> <script>var dojoConfig = { parseOnLoad: true };</script> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/"></script> <script> dojo.require("esri.map"); dojo.require("esri.layers.FeatureLayer"); dojo.require("esri.dijit.InfoWindowLite"); var map; function init() { var infoWindowLite = new esri.dijit.InfoWindowLite(null, dojo.create("div")); map = new esri.Map("mapDiv", { basemap: "topo", center: [-95.650, 29.772], zoom: 11 }); var infoWindowLite = new esri.dijit.InfoWindowLite(null, dojo.create("div", null, map.root)); infoWindowLite.startup(); map.setInfoWindow(infoWindowLite); var template = new esri.InfoTemplate(); template.setTitle("<b>${NAME}</b>"); template.setContent("${WEB} "); var featureLayer = new esri.layers.FeatureLayer(".../MapServer/0", { mode: esri.layers.FeatureLayer.MODE_ONDEMAND, infoTemplate:template, outFields: ["WEB"] }); map.addLayer(featureLayer); map.infoWindow.resize(200, 75); } dojo.ready(init); </script> </head> <body class="claro"> <div id="mapDiv"> </div> </body> </html>
... View more
07-02-2013
07:08 AM
|
0
|
8
|
2956
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|