RelationshipContent

AMD: require(["esri/popup/content/RelationshipContent"], (RelationshipContent) => { /* code goes here */ });
ESM: import RelationshipContent from "@arcgis/core/popup/content/RelationshipContent";
Class: esri/popup/content/RelationshipContent
Inheritance: RelationshipContent Content Accessor
Since: ArcGIS API 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 Feature Related Destination Feature
origin feature destination feature

Note

  • The related layer or table must also be added to the map to be able to configure RelationshipContent.
  • Editing related records is not supported.
  • Only up to 10 related features can be displayed in the list of related records.
  • Viewing related records is only supported for ArcGIS Online services and hosted services in ArcGIS Enterprise.
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

new RelationshipContent(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
String

The name of the class.

more details
Accessor
String

Describes the relationship's content in detail.

more details
RelationshipContent
Number

A numeric value indicating the maximum number of related features to display in the list of related records.

more details
RelationshipContent
String

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

more details
RelationshipContent
RelatedRecordsInfoFieldOrder[]

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.

more details
RelationshipContent
Number

The numeric id value for the defined relationship.

more details
RelationshipContent
String

A heading indicating what the relationship's content represents.

more details
RelationshipContent
String

The type of popup element displayed.

more details
RelationshipContent

Property Details

declaredClass Stringreadonly inherited

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

description String

Describes the relationship's content in detail.

displayCount 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 String

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

Value Description
list Shows a list of related records from the specified relationship.

For RelationshipContent the displayType is always "list".

Default Value:"list"

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 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 String

A heading indicating what the relationship's content represents.

type Stringreadonly

The type of popup element displayed.

For RelationshipContent the type is always "relationship".

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

more details
Accessor
this

Creates a deep clone of this object.

more details
RelationshipContent
*

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product.

more details
RelationshipContent
Boolean

Returns true if a named group of handles exist.

more details
Accessor

Removes a group of handles owned by the object.

more details
Accessor
Object

Converts an instance of this class to its ArcGIS portal JSON representation.

more details
RelationshipContent

Method Details

addHandles(handleOrHandles, groupKey)inherited

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

// Handle gets removed when the object is destroyed.
this.addHandles(handle);
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

clone(){this}

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
Type Description
this A deep clone of the class instance that invoked this method.
fromJSON(json){*}static

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.

Parameter
json Object

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
Type Description
* Returns a new instance of this class.
hasHandles(groupKey){Boolean}inherited

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}
removeHandles(groupKey)inherited

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");
toJSON(){Object}

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

Returns
Type Description
Object The ArcGIS portal JSON representation of an instance of this class.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.