I've recently noticed that my print widget is not working in one of my maps. However, it is working in two other maps. All three maps call to the same service and the same code blocks are used in all maps.
The biggest difference I have been able to locate between the maps is that the map where the print widget is not working is in 3.17, where the other two are in 3.14. I'd like to update my code in the one map so the print widget will work as it should. I've looked at the API reference for potential changes, but that hasn't proven to be fruitful.
When this map was first released, the print widget was working, so there is the chance the recent addition of tooltips is what has thrown this off. Any ideas?
Function and require statement:
require([
"dojo/dom-construct",
"esri/map",
"esri/Color",
"dojo/keys",
"esri/sniff",
"esri/SnappingManager",
"esri/renderers/SimpleRenderer",
"esri/config",
"esri/graphic",
"esri/lang",
"esri/geometry/Extent",
"esri/geometry/webMercatorUtils",
"esri/geometry/Point",
"esri/dijit/BasemapGallery",
"esri/dijit/HomeButton",
"esri/dijit/Search",
"esri/dijit/Popup",
"esri/dijit/PopupTemplate",
"esri/dijit/Scalebar",
"esri/dijit/Print",
"esri/dijit/Measurement",
"esri/InfoTemplate",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/FeatureLayer",
"esri/tasks/GeometryService",
"esri/tasks/PrintTemplate",
"esri/symbols/SimpleFillSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/SimpleMarkerSymbol",
"esri/symbols/PictureMarkerSymbol",
"esri/toolbars/draw",
"esri/urlUtils",
"esri/request",
"esri/SpatialReference",
"agsjs/dijit/TOC",
"dojo/_base/array",
"dojo/aspect",
"dojo/dom",
"dojo/dom-style",
"dojo/ready",
"dojo/on",
"dijit/TooltipDialog",
"dijit/popup",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dijit/TitlePane",
"dijit/form/Button",
"dojo/domReady!"],
function (domConstruct, Map, Color, keys, has, SnappingManager, SimpleRenderer, esriConfig, Graphic, esriLang, Extent, webMercatorUtils, Point, BasemapGallery, HomeButton, Search, Popup, PopupTemplate, Scalebar, Print, Measurement, InfoTemplate, ArcGISDynamicMapServiceLayer, FeatureLayer, GeometryService, PrintTemplate, SimpleFillSymbol, SimpleLineSymbol, SimpleMarkerSymbol, PictureMarkerSymbol, Draw, urlUtils, esriRequest, SpatialReference, TOC, array, aspect, dom, domStyle, ready, on, TooltipDialog, dijitPopup
)
Layouts:
var myLayouts = [{
"name": "Print_Landscape",
"label": "Landscape",
"format": "pdf",
"options": {
"legendLayers": [], // empty array means no legend
"scalebarUnit": "Miles",
"titleText": "State Parks"
}
}, {
"name": "Print_Portrait",
"label": "Portrait",
"format": "pdf",
"options": {
"legendLayers": [],
"scaleBarUnit": "Miles",
"titleText": "State Parks"
}
}];
/*
* Step: create the print templates
*/
var myTemplates = [];
dojo.forEach(myLayouts, function (lo) {
var t = new PrintTemplate();
t.layout = lo.name;
t.label = lo.label;
t.format = lo.format;
t.layoutOptions = lo.options
myTemplates.push(t);
});
Print Widget:
var printMap = new Print({
map: mapMain,
async: true,
url: "https://conservationgis.alabama.gov/adcnrweb/rest/services/DCNRExportWebMap/GPServer/Export%20Web%20...",
templates: myTemplates
}, dom.byId("PrintButton"));
printMap.startup();
Tooltips:
tooltips.setRenderer(new SimpleRenderer(tooltipFill));
tooltips.on('mouse-over', mouseOverGraphic);
tooltips.on('mouse-out', mouseOutGraphic);
//mouse over graphic
function mouseOverGraphic(evt) {
//disableTimer();
mapMain.infoWindow.clearFeatures();
mapMain.infoWindow.setTitle(" ");
mapMain.infoWindow.setContent(evt.graphic.attributes.NAME);
mapMain.infoWindow.show(evt.screenPoint);
}
function mouseOutGraphic(evt) {
timedClose();
}
function timedClose() {
clearTimeout(timer);
timer = setTimeout(
function() {
mapMain.infoWindow.hide();
}, 2000);
}
function disableTimer() {
clearTimeout(timer);
}
//I am using mapinfowindow so I attach mouseover and mouseout to the infowindow
infoWinMouseOver = on(mapMain.infoWindow.domNode, 'mouseover', function() {
disableTimer();
});
infoWinMouseOut = on(mapMain.infoWindow.domNode, 'mouseout', function() {
timedClose();
});
I just removed the tooltips and my print widget works. So the conflict lies there somewhere.