I am currently using the Election Polling Place template application for ArcGIS 10.1. I have the need to add a print button to the application. Using the sample ???Print dijit Print Templates Created using esri.request??? form the ArcGIs API for JavaScript samples page as a guide, I adjusted the code to handle the new print button.When I use this button I am getting the following error in Firebug ???TypeError: sym is Undefined??? this is coming form ?v=2.8compact (line 48)Anybody know how I might fix this errorCurrent code I am using
// get print templates from the export web map task
var printInfo = esri.request({
"url": printURL,
"content": { "f": "json" }
});
printInfo.then(handlePrintInfo, handleError);
function handlePrintInfo(resp) {
var layoutTemplate, templateNames, mapOnlyIndex, templates;
layoutTemplate = dojo.filter(resp.parameters, function(param, idx) {
return param.name === "Layout_Template";
});
if ( layoutTemplate.length == 0 ) {
console.log("print service parameters name for templates must be \"Layout_Template\"");
return;
}
templateNames = layoutTemplate[0].choiceList;
// remove the MAP_ONLY template then add it to the end of the list of templates
mapOnlyIndex = dojo.indexOf(templateNames, "MAP_ONLY");
if ( mapOnlyIndex > -1 ) {
var mapOnly = templateNames.splice(mapOnlyIndex, mapOnlyIndex + 1)[0];
templateNames.push(mapOnly);
}
// create a print template for each choice
templates = dojo.map(templateNames, function(ch) {
var plate = new esri.tasks.PrintTemplate();
plate.layout = plate.label = ch;
plate.format = "PDF";
plate.layoutOptions = {
"authorText": "May by: Esri's JS API Team",
"copyrightText": "<copyright info here>",
"legendLayers": [],
"titleText": "Pool Permits",
"scalebarUnit": "Miles"
};
return plate;
});
// create the print dijit
var printer = new esri.dijit.Print({
"map": map,
"templates": templates,
url: printURL
}, dojo.byId("print_button"));
printer.startup();
}
function handleError(err) {
alert(err);
console.log("Something broke: ", err);
}