Skip to content
import AttachmentsContent from "@arcgis/core/popup/content/AttachmentsContent.js";
Inheritance:
AttachmentsContentContentAccessor
Since
ArcGIS Maps SDK for JavaScript 4.11

An AttachmentsContent popup element represents an attachment element associated with a feature. This resource is available only if the FeatureLayer.capabilities.data.supportsAttachment or the Sublayer.capabilities.data.supportsAttachment is true.

Preview viewList view
popuptemplate-attachments-element-previewpopuptemplate-attachments-element-list
See also
Example
// Create the AttachmentsContent popup element
// If the selected feature has attributes associated with it, they will display within the popup
let attachmentsElement = new AttachmentsContent({
// Shows all attachments as a list of linked files
displayType: "list",
// Sorts the attachments by their `ATT_NAME` attachmentInfo field in descending order
orderByFields: [{ field: "ATT_NAME", order: "descending" }]
});
// Create the PopupTemplate
let template = new PopupTemplate({
title: "Beverly Hills trees by block",
outFields: ["*"],
content: [attachmentsElement]
});

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
PropertyTypeClass
("application" | "audio" | "image" | "model" | "text" | "video")[] | null | undefined
declaredClass
readonly inherited
"auto" | "preview" | "list"
type
readonly
"attachments"

attachmentKeywords

Property
Type
string[] | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.34

An array of strings used to identify attachment(s). When keywords are specified, attachments will be filtered using this array of keywords. Matching is case-sensitive and requires exact keyword matches; partial matches are not supported.

See also

attachmentTypes

Property
Type
("application" | "audio" | "image" | "model" | "text" | "video")[] | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.34

An array of strings representing MIME types. Attachments will be filtered based on the specified array of MIME types.

See also

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

description

Property
Type
string | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.19

Describes the attachment's content in detail. Starting at version 4.30, the description supports rendering HTML.

displayType

Property
Type
"auto" | "preview" | "list"
Since
ArcGIS Maps SDK for JavaScript 4.22

A string value indicating how to display an attachment.

ValueDescription
autoThe attachments will display in preview mode if the feature layer capabilities or sublayer capabilites support resized attachments. Otherwise, the attachments are displayed in list mode.
previewShows a thumbnail image of the attachment.
listShows a list of attachment links.
Default value
"auto"

orderByFields

autocast Property
Type
AttachmentsOrderByInfo[] | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.32

An array of AttachmentsOrderByInfo indicating the display order for the attachments, and whether they should be sorted in ascending or descending order. This only applies if the feature layer capabilities supports attachment.supportsOrderByFields.

Example
// Sort the attachments by their `ATT_NAME` attribute in descending order
const attachmentsElement = new AttachmentsContent({
orderByFields: [
{ field: "ATT_NAME", order: "descending" }
]
});

title

Property
Type
string | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.19

A heading indicating what the attachment's content represents. Starting at version 4.30, the title supports rendering HTML.

type

readonly Property
Type
"attachments"
Default value
"attachments"

Methods

MethodSignatureClass
fromJSON
inherited static
fromJSON(json: any): any
clone
inherited
clone(): this
toJSON
inherited
toJSON(): any

fromJSON

inheritedstatic Method
Signature
fromJSON (json: any): any
Inherited from: JSONSupportMixin

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameters
ParameterTypeDescriptionRequired
json
any

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns
any

Returns a new instance of this class.

clone

inherited Method
Signature
clone (): this
Inherited from: ClonableMixin

Creates a deep clone of this object. Any properties that store values by reference will be assigned copies of the referenced values on the cloned instance.

Returns
this

A deep clone of the class instance that invoked this method.

toJSON

inherited Method
Signature
toJSON (): any
Inherited from: JSONSupportMixin

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns
any

The ArcGIS portal JSON representation of an instance of this class.