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 |
---|---|
![]() |
![]() |
Note
- The related layer or table must also be added to the map to be able to configure
RelationshipContent
. - Only up to 10 related features can be displayed in the list of related records.
- Viewing related records is only supported for ArcGIS Online feature services.
- See also
// 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)
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
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 | 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
-
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"
-
orderByFields RelatedRecordsInfoFieldOrder[]
-
An array of RelatedRecordsInfoFieldOrder indicating the display order for the related records, and whether they should be sorted in ascending
asc
or descendingdesc
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
istrue
.
-
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
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 } ); this.addHandles(handle); // Destroy the object this.destroy();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey 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.
ReturnsType 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.Parameterjson ObjectA 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.
ReturnsType Description * Returns a new instance of this class.
-
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType 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.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.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.
ReturnsType Description Object The ArcGIS portal JSON representation of an instance of this class.