Skip to content
import RelationshipContent from "@arcgis/core/popup/content/RelationshipContent.js";
Inheritance:
RelationshipContentContentAccessor
Since
ArcGIS Maps SDK for JavaScript 4.25

A RelationshipContent popup element represents a relationship element associated with a feature. This can only be configured if the related layer or table is added to the map.

RelationshipContent provides a way to browse related records of the current selected feature within its popup, as shown in the images below. The Origin Feature image shows a popup template configured with RelationshipContent. When selecting one of the related features in the list, the popup template for the chosen related destination feature displays. The Related Destination Feature image shows the destination popup template content with FieldsContent and RelationshipContent configured. When exploring a related feature's RelationshipContent, one could navigate into that feature's related records or exit the origin feature's related record exploration with the arrow button.

Origin FeatureRelated Destination Feature
origin featuredestination feature

Note The related layer or table must also be added to the map to be able to configure RelationshipContent. For feature services, viewing related records is only supported for ArcGIS Online and ArcGIS Enterprise version 11.2 or higher. For map services, viewing related records is only supported for ArcGIS Online and ArcGIS Enterprise version 11.3 or higher. Starting at version 4.32, RelationshipContent can be configured on SubtypeSublayer popup templates when both the origin and destination features belong to a SubtypeGroupLayer.

See also
Examples
// Create the RelationshipContent popup element
const relationshipContent = new RelationshipContent({
relationshipId: 3,
title: "Cities in {COUNTY_NAME}",
description: "All the cities that reside in {COUNTY_NAME}.",
displayCount: 3,
// Autocasts as new array of RelatedRecordsInfoFieldOrder objects
orderByFields: [{
field: "CITY",
order: "asc"
}]
});
// Create the RelationshipContent popup element
// and add it to the popup template content for the layer.
layer.popupTemplate.content = [{
// Autocasts as new RelationshipContent object
type: "relationship",
relationshipId: 1,
title: "Hydrant Maintenance Inspections",
description: "Hydrant maintenance inspections for {expression/asset}",
displayCount: 5,
// Autocasts as new array of RelatedRecordsInfoFieldOrder objects
orderByFields: [{
field: "INSTALLDATE",
order: "desc"
}]
}];

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.

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

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

displayCount

Property
Type
number

A numeric value indicating the maximum number of related features to display in the list of related records. The maximum number of related records to display in the list of related records is 10. If no value is specified, the Show all button will be available to display all related records.

displayType

Property
Type
"list"

A string value indicating how to display related records within the relationship content.

ValueDescription
listShows a list of related records from the specified relationship.
Default value
"list"

orderByFields

autocast Property
Type
RelatedRecordsInfoFieldOrder[] | null | undefined

An array of RelatedRecordsInfoFieldOrder indicating the display order for the related records, and whether they should be sorted in ascending asc or descending desc order.

relationshipId

Property
Type
number

The numeric id value for the defined relationship. This value can be found on the service itself or on the service's relationships resource if supportsRelationshipResource is true.

title

Property
Type
string | null | undefined

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

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.