I am attempting to display related fields in a popup window. I've created a GraphicsLayer, consisting of features from the results of a QueryTask. Upon adding the features to the GraphicsLayer, I am assigning a popupTemplate to each feature:
var popupTemplate = {
title: "<b>{LONGNAME}</b>",
content: [{
type: "fields",
fieldInfos: [{
fieldName: "SPACEID",
label: "Space Identifier",
visible: true
},{
fieldName: "relationships/1/VERTICALORDER",
label: "Vertical Order",
visible: true
}]
}]
};
However, this technique does not seem to be able to reference the related table. The [SPACEID] field value is visible, but the related field value is not. Am I doing something wrong, or is there a different way to accomplish this?
EDIT: Perhaps this functionality is not possible yet? I've tested this with a simple FeatureLayer, and the relationship is not honored.
var layer = new FeatureLayer({
url: baseURL + "/2",
popupTemplate: { // autocasts as new PopupTemplate()
title: "<b>{LONGNAME}</b>",
content: [{
type: "fields",
fieldInfos: [{
fieldName: "SPACEID",
label: "Space Identifier",
visible: true
},{
fieldName: "relationships/3/FIRSTNAME",
label: "Employee Name",
visible: true
}]
}]
}
});
I have verified the relationship is functioning, using the REST queryRelatedRecords window. However the FeatureLayer does not see the table. Is there something further that needs to be done? I should note that the service is a MapService, in case that matters.
1 Answer 1
fieldName: "relationships/1/VERTICALORDER"
means that have created a second RelationShip in your GraphicLayer.
If you didn't, (otherwise you would have post the code) then you have two options :
build a RelationQuery https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html to add its results to your features, so you'll get a new field
VERTICALORDER
build a RelationShip https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Relationship.html to your GraphicLayer
-
I have a relationship for the MapService layer from which the features used to create the GraphicLayer came from. The GraphicLayer doesn't, as far as I can tell, have any relationships. Can you elaborate on how one would create a new relationship?Barbarossa– Barbarossa2018年05月23日 20:34:47 +00:00Commented May 23, 2018 at 20:34
Explore related questions
See similar questions with these tags.