Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: AttachmentEditor

require(["esri/dijit/editing/AttachmentEditor"], function(AttachmentEditor) { /* code goes here */ });

Description

(Added at v2.0)
Widget that supports viewing attachments for feature layers that have attachments enabled. If the feature layers are from a feature service then the attachment editor will include the ability to create, view and delete attachments.

Samples

Search for samples that use this class.

Constructors

NameSummary
new AttachmentEditor(params, srcNodeRef)Creates a new AttachmentEditor object.

Methods

NameReturn typeSummary
showAttachments(graphic, featureLayer)NoneDisplay the attachment editor.
startup()NoneFinalizes the creation of the attachment editor.
Constructor Details

new AttachmentEditor(params, srcNodeRef)

Creates a new AttachmentEditor object.
Parameters:
<Object> params Required No parameter options.
<Node | String> srcNodeRef Required HTML element where the widget is rendered.
Sample:
require([
  "esri/map", "esri/dijit/editing/AttachmentEditor", "dojo/dom", ... 
], function(Map, AttachmentEditor, dom, ... ) {
  var map = new Map( ... );
  map.infoWindow.setContent("<div id='content' style='width:100%'></div>");
  map.infoWindow.resize(350,275);
  var attachmentEditor = new AttachmentEditor({}, dom.byId("content"));
  attachmentEditor.startup();
  ...
});
Method Details

showAttachments(graphic, featureLayer)

Display the attachment editor.
Parameters:
<Graphic> graphic Required Graphic, with attachments, to display in the attachment editor.
<FeatureLayer> featureLayer Required The feature layer to display attachments for. The feature layer must have attachments enabled.
Sample:
require([
  "esri/map", "esri/layers/FeatureLayer", "esri/dijit/editing/AttachmentEditor", ... 
], function(Map, FeatureLayer, AttachmentEditor, ... ) {
  var map = new Map( ... );
  var featureLayer = new FeatureLayer( ... );
  var attachmentEditor = new AttachmentEditor( ... );
  connect.connect(featureLayer, "onClick", function(evt) {
    //display the attachment editor in the map's info window.
    attachmentEditor.showAttachments(evt.graphic,featureLayer);
    map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));
  });
  ...
});

startup()

Finalizes the creation of the attachment editor. Call startup() after creating the widget when you are ready for user interaction.
Show Modal