alextaochen

Cannot apply AttachmentEditor to map.graphics

Discussion created by alextaochen on May 12, 2013
The graphicLayer on my ESRI map JS object contains some graphics that come from a query operation on a feature layer. I tried to attach onClick to those graphics and attachment editor for each of them. However, AttachmentEditor didn't work at all.

var attachmentDivContent = "<div id='content' style='width:100%'></div>";
  map.infoWindow.resize(350, 200);
 
  dojo.connect(map.graphics, "onClick", function(evt) {
   var locName = evt.graphic.attributes['LocationNa'];
   map.infoWindow.setTitle(locName);
   map.infoWindow.setContent("<div id='divInfoWindowCentent' style='width:100%'>HELLO graphics " + locName + attachmentDivContent + "</div>");
   var attachmentEditor = new esri.dijit.editing.AttachmentEditor({}, dojo.byId("content"));
   attachmentEditor.startup();
   attachmentEditor.showAttachments(evt.graphic, featureLayer);
   map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));
  });

The above code only showed "HELLO graphics " + {LocationName} and AttachmentEditor didn't work to work.

Could anyone point out anything wrong with the code? Thanks.

Cheers,
Alex

Outcomes