Solved! Go to Solution.
var items = dojo.map(results, function (result) { var graphic = result.feature; var sms = esri.symbol.SimpleMarkerSymbol; var sls = esri.symbol.SimpleLineSymbol; graphic.setSymbol( new sms( "circle", 14, new sls("solid", new dojo.Color([6, 105, 140]), 1), new dojo.Color([6, 105, 140, 0.5]) ) ); app.map.graphics.add(graphic); return dojo.clone(graphic.attributes); });
The underlying print code in the JS API processes all map layers (including graphics) to remove object properties that are undefined or null (two reasons for this: it's a waste to send properties that are undefined or null and the print service doesn't handle those types of values elegantly). When the JS API print code tries to process the graphic's attributes after they've been put through Dojo's store creation process it gets into an infinite loop somewhere. I haven't completely figured out the details on this, but it's definitely the source of your error.
I think my situation is similar to Ingrid here, wherein there are a lot of NULL attributes in the data. I am completely confused about this right now, please help me out on these queries:
Will these NULL attributes affect the print code of the JS API only when they are present in results ? (I think this might not be the case since I have removed NULL attributes for the retrieved data and still encountered the same error)
Does the print code consider the data attributes of all the layers of the map ? (Although the print code works fine when no graphics are selected)
var Findsymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([98, 194, 204]), 2), new dojo.Color([98, 194, 204, 0.5])); var items = dojo.map(results, function (result) { var graphic = result.feature; graphic.setSymbol(Findsymbol); map.graphics.add(graphic); return dojo.clone(graphic.attributes); //return result.feature.attributes; });
function onRowClickHandlerLS(evt) { var clickedFeature = gridx.getItem(evt.rowIndex).OBJECTID; var selectedFeature; dojo.forEach(map.graphics.graphics, function (graphic) { if ((graphic.attributes) && graphic.attributes.OBJECTID === clickedFeature) { selectedFeature = graphic; return; } }); var FeatureExtent = selectedFeature.geometry.getExtent(); map.setExtent(FeatureExtent); } "Uncaught TypeError: Cannot read property 'geometry' of undefined "
function onRowClickHandlerLS(evt) { var clickedFeature = gridx.getItem(evt.rowIndex).OBJECTID; var selectedFeature; dojo.forEach(map.graphics.graphics, function (graphic) { var n1 = graphic.attributes.OBJECTID.toString(); var n2 = clickedFeature.toString(); if ((graphic.attributes) && n1 === n2) { console.debug("..." + n1 + "..." + n2 + "...") selectedFeature = graphic; return; } }); var FeatureExtent = selectedFeature.geometry.getExtent(); map.setExtent(FeatureExtent); }
dojo.forEach(response,function(result){ var feature = result.feature; feature.setSymbol(markerSymbol); map.graphics.add(feature); return dojo.clone(feature.attributes);