POST
|
Something like this?
map.graphics.enableMouseEvents();
dojo.connect(map.graphics, "onClick", function(evt) {
// Set your events on the pop up as you want
});
I am not sure exactly when this is fired in comparison to the info popup opening, but I would start here and see if it suits your needs. In this example I set the entire content of the popup on graphic click, and it functioned well, but it was a simple example.
... View more
05-08-2012
08:18 AM
|
0
|
0
|
294
|
POST
|
var lastSelectedGraphic;
function init() {
/**
** Do your init work here...
**/
map.graphics.enableMouseEvents();
dojo.connect(map.graphics, "onClick", function(evt) {
lastSelectedGraphic = evt.graphic;
// You can do more work with the graphic here, but it is also stored for access anytime time later.
});
}
init();
From there you can get what you need, I think.
... View more
05-08-2012
05:22 AM
|
0
|
0
|
230
|
POST
|
This should work for you. Its less about the map api and more about getting it to work in the javascript. I use jquery. Here is the code to make things work: // <Init> map.graphics.enableMouseEvents(); dojo.connect(map.graphics, "onClick", function(evt) { map.infoWindow.setContent("<a href='#' onclick='getDataResults(evt.graphic.attributes.Id)'>Get Data Results</a>"); // Assumes id is on the graphic somewhere }); // </Init> function getDataResults(id) { $.get('/GetSomeResults/' + id, function (content) { document.getElementById('resultsGrid').innerHTML = content; } ); } and some HTML: [HTML]<div id="resultsGrid"></div>[/HTML]
... View more
05-08-2012
04:58 AM
|
0
|
0
|
214
|
POST
|
Try removing the '/1' off the URL so it is just "http://esoc1.nscorp.com/ArcGISProduction/rest/services/EGIS/ENG_TRACK/MapServer" I am still new to this whole API, so I sometimes need to just take stabs at things as well. So, I would try removing that, and if that doesn't work I would try ArcGISDynamicMapServiceLayer (requires dojo.require("esri.layers.agsdynamic")) and ArcGISImageServiceLayer. I don't know what the service is, so it could be either of those I suppose.
... View more
05-03-2012
08:39 AM
|
0
|
0
|
662
|
POST
|
I don't think that is a valid constructor for the GraphicsLayer, it needs to be new GraphicsLayer() or new GraphicsLayer({<options>}). I looks to me like maybe you simply want to add an overlay to the map, then add graphics for the cities? Like this:
var TrackLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://esoc1.nscorp.com/ArcGISProduction/rest/services/EGIS/ENG_TRACK/MapServer/1");
//...then
dojo.forEach(featureSet.features, function(feature) {overlaymap.add(feature.setSymbol(TrackSymbol));
... View more
05-03-2012
07:30 AM
|
0
|
0
|
662
|
POST
|
This is a little messy, but it works and should serve as an example as to how you could make this work. I use JQuery, so hopefully that isn't an issue. During the initialization:
map.graphics.enableMouseEvents();
dojo.connect(map.graphics, "onClick", function(evt) {
map.infoWindow.setContent("<span id='spanSelectPDF'></span><span><input type='button' value='Open PDF' onclick='openPDF();' /></span>");
var URLs = evt.graphic.attributes.PDFs.split(";"); // Assumes attribute's name is 'PDFs'
if (URLs.length > 1) { // More than 1 pdf, so use a select list...
var selectList = $("<select id='selectPDF' />");
selectList.append($("<option selected='selected'>Select PDF</option>"));
for (var i = 0; i < URLs.length; i++) {
var url = URLs;
selectList.append($("<option value='" + url + "'>" + url + "</option>"));
}
$("#spanSelectPDF").append(selectList);
} else { // One (or fewer) pdfs, just put the URL in the span to display
$("#spanSelectPDF").html(URLs[0]);
}
}); Then the code for "openPDF()": function openPDF() {
var url;
if ($("#selectPDF").length > 0) // Check if the select list exists
url = $("#selectPDF").find("option:selected").val(); // get the value of the selected option
else
url = $("#spanSelectPDF").html(); // otherwise use the html we stuck in the span as the link
if (url != "") // Check the url has a value, as our default option has no value (requires that the user make a selection)
window.open(url); // Open the link
}
Hope this helps.
... View more
05-02-2012
11:53 AM
|
0
|
0
|
184
|
POST
|
I saw this in your code: layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://[our server]/ArcGIS/rest/services/testarea/property/MapServer"); Are you using an absolute URL? If so, that could be your issue on the local network.
... View more
05-01-2012
04:17 AM
|
0
|
0
|
176
|
POST
|
You may want to round the coordinates as it goes out quite a few decimal places. I use three: dojo.byId("spanCoords").innerHTML = (Math.round(mp.x * 1000) / 1000) + ", " + (Math.round(mp.y * 1000) / 1000);
... View more
04-30-2012
11:08 AM
|
0
|
0
|
239
|
POST
|
dojo.connect(map, "onMouseMove", function(evt) {
var mp = esri.geometry.webMercatorToGeographic(evt.mapPoint);
dojo.byId("spanCoords").innerHTML = mp.x + ", " + mp.y;
}); and html: [HTML]<div style="position: absolute; bottom: 5px; left: 5px; z-index: 8999; padding: 5px; background-color: #FFF;"> Hover coordinates: <span id="spanCoords"></span> </div>[/HTML]
... View more
04-30-2012
11:03 AM
|
0
|
0
|
239
|
POST
|
I can't help with the dojo stuff as I don't know it, but I set my infoTemplate in the following way: newMemberTemplate = new esri.InfoTemplate("<b>New User Information</b>");
newMemberTemplate.content = getTextContent;
// getTextContent defined as
function getTextContent(obj) { }
Hope this helps.
... View more
04-30-2012
10:25 AM
|
0
|
0
|
194
|
POST
|
If I am understanding your problem correctly, this would be one way to do it. I am not all that familiar with dojo, but this is what you could try using JQuery: $("#imagery").change(function (evt) { layerVisibility(mapLayers[0]); }); Otherwise, I think you need to put layerVisibility(mapLayers[0]) in a function, so: dojo.connect(dijit.byId('imagery'), 'onChange', function(evt) { layerVisibility(mapLayers[0]); });
... View more
04-30-2012
09:44 AM
|
0
|
0
|
728
|
POST
|
How can i add to this to show the X and Y coordinates in the bottom left like the sample: http://help.arcgis.com/en/webapi/javascript/arcgis/demos/map/map_xycoords.html dojo.connect(map, "onMouseMove", function(evt) {
var mp = esri.geometry.webMercatorToGeographic(evt.mapPoint);
dojo.byId("<elementId>").innerHTML = mp.x + ", " + mp.y;
});
... View more
04-30-2012
09:04 AM
|
0
|
0
|
423
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|