|
POST
|
thejus kambi As a part of business requirement we need to show the button in the infowindow and clciking on which the widget needs to handle some functionality. I can create the template with outerHTML(string) but then how should I handle the click event in the Widget. Also how should i maintain the scope of the widget(this) when calling the event handler.
... View more
06-02-2015
07:31 AM
|
0
|
2
|
2725
|
|
POST
|
thejus kambi I tried that but when we set outerHTML, events are not working. for e.g Click event for the button.
... View more
06-02-2015
06:57 AM
|
0
|
4
|
2725
|
|
POST
|
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--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>Graphic InfoTemplate sample</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css">
<style>
html, body, #mapDiv
{
padding: 0;
margin: 0;
height: 100%;
}
button
{
display: block;
}
</style>
<script src="http://js.arcgis.com/3.13/"></script>
<script>
var map;
require([
"esri/map",
"esri/symbols/SimpleMarkerSymbol",
"esri/InfoTemplate",
"esri/graphic",
"esri/Color", "dojo/dom", "dojo/dom-construct", "dojo/on", "dojo/domReady!"
], function (
Map,
SimpleMarkerSymbol,
InfoTemplate,
Graphic,
Color, dom, domConstruct, on
) {
//create symbol for graphic
var markerSymbol = new SimpleMarkerSymbol();
markerSymbol.setPath("M16,4.938c-7.732,0-14,4.701-14,10.5c0,1.981,0.741,3.833,2.016,5.414L2,25.272l5.613-1.44c2.339,1.316,5.237,2.106,8.387,2.106c7.732,0,14-4.701,14-10.5S23.732,4.938,16,4.938zM16.868,21.375h-1.969v-1.889h1.969V21.375zM16.772,18.094h-1.777l-0.176-8.083h2.113L16.772,18.094z");
markerSymbol.setColor(new Color("#00FFFF"));
var count = 1;//by default set graphic count to 1
//create map
map = new Map("mapDiv", { basemap: "streets", center: [-25.312, 34.307], zoom: 3});
map.on("click", addGraphic);
function addGraphic(evt) {
var graphic, infoTemplate, templateDiv, templateButton;
if (evt.graphic) {
//display infowindow if graphic is clicked.
map.infoWindow.show();
} else {
//create new graphic
graphic = new Graphic(evt.mapPoint, markerSymbol);
//create info template for graphic
infoTemplate = new InfoTemplate();
infoTemplate.setTitle("Graphic " + count);
//create template containing DOM node
templateDiv = domConstruct.create("div", { "style": "background-color:grey; color:white; height:60px", 'innerHTML': "Graphic " + count }, null);
templateButton = domConstruct.create("button", { 'innerHTML': "Button for Graphic " + count }, templateDiv);
//set Content
infoTemplate.setContent(templateDiv);
//set infoTemplate to graphic
graphic.setInfoTemplate(infoTemplate);
//Add Graphics on map
map.graphics.add(graphic);
count++;
}
}
});
</script>
</head>
<body>
<div id="mapDiv">
</div>
</body>
</html>
... View more
06-02-2015
06:30 AM
|
0
|
9
|
2725
|
|
POST
|
We are using "esri/InfoTemplate" to show infowindow for the Graphics. And when we are setting any Node (element) as the content for infoTemplate we can see the infowindow properly only for first time , however next time onward when we click on same graphic the blank infowindow is shown. Following are our observations: If string is set as the content for InfoTemplate then the infowindow is always shown properly. If an element is set as the content for InfoTemplate and when we click on the graphics for first time we can see the infowindow as expected. However from next click on the graphic the innerHTML of element(which is set as content) gets cleared(Empty). Infowindow content when graphic is clicked for first time: Infowindow content when same graphic is clicked for second time: Below is the code Sample: <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--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>Graphic InfoTemplate sample</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css">
<style>
html, body, #mapDiv
{
padding: 0;
margin: 0;
height: 100%;
}
button
{
display: block;
}
</style>
<script src="http://js.arcgis.com/3.13/"></script>
<script>
var map;
require([
"esri/map",
"esri/symbols/SimpleMarkerSymbol",
"esri/InfoTemplate",
"esri/graphic",
"esri/Color", "dojo/dom", "dojo/dom-construct", "dojo/on", "dojo/domReady!"
], function (
Map,
SimpleMarkerSymbol,
InfoTemplate,
Graphic,
Color, dom, domConstruct, on
) {
//create symbol for graphic
var markerSymbol = new SimpleMarkerSymbol();
markerSymbol.setPath("M16,4.938c-7.732,0-14,4.701-14,10.5c0,1.981,0.741,3.833,2.016,5.414L2,25.272l5.613-1.44c2.339,1.316,5.237,2.106,8.387,2.106c7.732,0,14-4.701,14-10.5S23.732,4.938,16,4.938zM16.868,21.375h-1.969v-1.889h1.969V21.375zM16.772,18.094h-1.777l-0.176-8.083h2.113L16.772,18.094z");
markerSymbol.setColor(new Color("#00FFFF"));
var count = 1;//by default set graphic count to 1
//create map
map = new Map("mapDiv", { basemap: "streets", center: [-25.312, 34.307], zoom: 3});
map.on("click", addGraphic);
function addGraphic(evt) {
var graphic, infoTemplate, templateDiv, templateButton;
if (evt.graphic) {
//display infowindow if graphic is clicked.
map.infoWindow.show();
} else {
//create new graphic
graphic = new Graphic(evt.mapPoint, markerSymbol);
//create info template for graphic
infoTemplate = new InfoTemplate();
infoTemplate.setTitle("Graphic " + count);
//create template containing DOM node
templateDiv = domConstruct.create("div", { "style": "background-color:grey; color:white; height:60px", 'innerHTML': "Graphic " + count }, null);
templateButton = domConstruct.create("button", { 'innerHTML': "Button for Graphic " + count }, templateDiv);
//set Content
infoTemplate.setContent(templateDiv);
//set infoTemplate to graphic
graphic.setInfoTemplate(infoTemplate);
//Add Graphics on map
map.graphics.add(graphic);
count++;
}
}
});
</script>
</head>
<body>
<div id="mapDiv">
</div>
</body>
</html> Steps to reproduce: 1.Click on map to add the graphics. 2.Now click on the graphic. (observe that you will see the text "Graphic 1" and a Button) : 3. Close the infowindow 4.Now click on the same graphic again. (observe that you will not see the text and Button) :
... View more
06-02-2015
05:48 AM
|
0
|
14
|
7669
|
|
POST
|
Thanks Kelly this is good sample, but we have our own custom implementation of BasemapToggle widget with different UI and also supporting different types of layers, so we cant use the base map toggle widget. We are using same techniquie as shown in the attached sample in our custom implementation of BasemapToggle widget It would be great help if we could solve this issue by some other way. please suggest.
... View more
04-10-2015
11:36 AM
|
0
|
0
|
1327
|
|
POST
|
Kelly Hutchins We have found that this is occuring only when we have webmap and the webmap has "National Geographic Map" as a default basemap. I have Attached the Code and also below is the code for the same sample. <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Create web map from id</title>
<style>
html,
body,
#map {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
body {
background-color: #FFF;
overflow: hidden;
font-family: "Trebuchet MS";
}
#toggleButton {
position: absolute;
z-index: 1000;
top: 20px;
right: 24px;
}
#handelButton {
position: absolute;
z-index: 1000;
top: 20px;
right: 150px;
}
</style>
<link rel="stylesheet" href="http://js.arcgis.com/3.13/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css">
<script src="http://js.arcgis.com/3.13/"></script>
<script>
var map, basemapIndex = 1,
handeledLayerEvents = false;
require([
"dojo/_base/array",
"dojo/dom",
"esri/urlUtils",
"esri/arcgis/utils",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/ArcGISTiledMapServiceLayer",
"esri/config",
"dojo/domReady!"
], function(
array,
dom,
urlUtils,
arcgisUtils,
ArcGISDynamicMapServiceLayer,
ArcGISTiledMapServiceLayer,
esriConfig
) {
esriConfig.defaults.io.proxyUrl = "/proxy/";
//load basemap
arcgisUtils.arcgisUrl = "http://www.arcgis.com/sharing/rest/content/items";
var webmap = arcgisUtils.createMap("ceccc4e5a9dd4f649b3448c6638f4532", "map").then(function(response) {
map = response.map;
basemapIndex = 2;
if (response.itemInfo.itemData.baseMap.baseMapLayers) {
_setBasemapLayerId(response.itemInfo.itemData.baseMap.baseMapLayers);
}
}, function(err) {
console.log(err);
});
dom.byId("toggleButton").onclick = function() {
var basemap;
map.removeAllLayers();
if (basemapIndex == 1) {
basemapIndex = 2;
basemap = new ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer", {
id: "defaultBasemap",
visible: true
});
map.addLayer(basemap, 0);
} else {
basemapIndex = 1;
basemap = new ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer", {
id: "defaultBasemap",
visible: true
});
map.addLayer(basemap, 0);
}
map.addLayer(basemap, 0);
};
/**
* set default id for basemaps
* @memberOf widgets/mapSettings/mapSettings
*/
function _setBasemapLayerId(baseMapLayers) {
var i = 0,
defaultId = "defaultBasemap";
if (baseMapLayers.length === 1) {
_setBasemapId(baseMapLayers[0], defaultId);
} else {
for (i = 0; i < baseMapLayers.length; i++) {
_setBasemapId(baseMapLayers, defaultId + i);
}
}
}
/**
* set default id for each basemap of web map
* @memberOf widgets/mapSettings/mapSettings
*/
function _setBasemapId(basmap, defaultId) {
var layerIndex;
map.getLayer(basmap.id).id = defaultId;
map._layers[defaultId] = map.getLayer(basmap.id);
layerIndex = array.indexOf(map.layerIds, basmap.id);
if (defaultId !== basmap.id) {
delete map._layers[basmap.id];
}
map.layerIds[layerIndex] = defaultId;
}
});
</script>
</head>
<body class="claro">
<div id="map">
<button id="toggleButton">
Change BaseMap</button>
</div>
</body>
</html>
... View more
04-10-2015
10:07 AM
|
0
|
2
|
1327
|
|
POST
|
Kelly Hutchins Matt Driscoll We are getting all the items with tag "DMR" from organisation url as "arcgis.com" and in result we are getting some items which are from the Expired Organisation, for example item id "4f59091c079e45b081d49430bb981064". when we try to get the details of this item using arcgisUtils.getItem method then the identity manager get opens and and ask for the credential although this item is public, whereas if we enter any valid credentials to AGOL still we will not get the item details. However we can see some errors like: "Subscription is disabled, the item is not accessible" in browser console. We think that API should not return items from the expired organisation when we query, or their should be some tags in the item info which will indicate that this item is from the expired(NON Active) org.
... View more
04-10-2015
01:40 AM
|
0
|
2
|
3845
|
|
POST
|
Kelly Hutchins We are facing same of problem of attribution not getting updated on basemap change if we create a map using any webmap which having “National Geographic word map” as a basemap. Please Suggest.
... View more
04-10-2015
01:24 AM
|
0
|
4
|
1327
|
|
POST
|
Kelly Hutchins Please provide some directions to this. When we are querying for all the items in org(arcgis.com) with tag "DMR" we are getting some item id's from the Inactive(Expired) organisation like one which I mentioned above("4f59091c079e45b081d49430bb981064"). Is it possible in some way if API don't return this Items. Thank You .
... View more
04-08-2015
07:22 AM
|
0
|
0
|
997
|
|
POST
|
Hi, We are issue with js API 3.11, when we hide the mapdiv and resize the window and when we see the map again it doesnt work properl and goes out of extent.Also we can see some error in developer tool. - Error: Invalid value for <circle> attribute cx="NaN" We have tried handling map resize manually as suggested at this link Hidden map becomes currupt after browser resize but still the map is not working properly. We've put a quick example of this behaviour here: http://jsfiddle.net/ZM3SM/164/ Thanks & Regards, Sumit Zarkar.
... View more
11-20-2014
07:22 AM
|
0
|
2
|
1370
|
|
POST
|
Hi Hutchins, We are facing same issue with js API 3.11, although we have handled map resize manually. We've put a quick example of this behaviour here: http://jsfiddle.net/ZM3SM/164/ But now the map extent is lost completely and we can see some error in developer tool. : Error: Invalid value for <circle> attribute cx="NaN" Thanks & Regards, Sumit Zarkar.
... View more
11-20-2014
06:52 AM
|
0
|
0
|
863
|
|
POST
|
Hi I need some help on AGSTiledMapServiceLayer. For a TiledMapsService that I need to invoke, it requires an custom setting to be passed in the request header for security. I understand we can set URL to AGSTiledMapServiceLayer object but did not see a way to set the Request object. Is there any way to pass AGSRequest or to add additional headers directly? Are there any alternatives? For Eg: NSMutableDictionary *HeaderDictionary = [[NSMutableDictionary alloc] init]; [HeaderDictionary setValue:@“<Header Value>” forKey:@“<Header Key>"]; [AGSRequest setAdditionalUserAgentInfo:[NSString stringWithFormat:@"%@", HeaderDictionary]]; [AGSRequest requestForURL:tiledMapServiceURL credential:nil resource:nil queryParameters:nil method:AGSRequestHTTPMethodGet cachePolicy:nil timeoutInterval:60.0 userHeaders: HeaderDictionary] ; //Now how do I set this Request in AGSTiledMapServiceLayer?
... View more
10-31-2014
12:08 AM
|
1
|
0
|
2843
|
|
POST
|
HI, We have published feature service on AGOL, and have added more than 10,000 features on it. Now while deleting all the records from rest end using deletefeature and setting where clause as "1=1", the operation is getting completed and also getting some coded values which are not readable. Attached is the screenshot of the output. Regards, Sumit Zarkar
... View more
08-01-2014
12:02 AM
|
0
|
0
|
606
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 12-11-2015 04:27 AM | |
| 1 | 12-13-2015 11:28 PM | |
| 1 | 08-19-2015 12:53 AM | |
| 3 | 12-02-2015 11:46 PM | |
| 3 | 12-02-2015 11:46 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:24 AM
|