Skip to content

Instantly share code, notes, and snippets.

@green3g
Created January 26, 2017 17:01
Show Gist options
  • Save green3g/f0a85ed8f7111392618990c8398b4c15 to your computer and use it in GitHub Desktop.
Save green3g/f0a85ed8f7111392618990c8398b4c15 to your computer and use it in GitHub Desktop.
multiple relationships in an identify popup
identifies: {
wellFields: {
1: {
title: 'Petrolium',
//for our content formatter, we call the function, since
//it returns a function
content: formatters.relationship(
[{
objectIdField: 'OBJECTID',
url: 'http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/1',
relationshipId: 1,
columns: [{
field: 'FIELD_KID',
label: 'Field KID'
}, {
field: 'WELL_NAME',
label: 'Name'
}]
}, {
// add another relationship here
}
]
)
}
}
}
relationship: function(relationships) {
//create a new function and return it
return function(data) {
//create a tab container to hold our tables
var container = new TabContainer({
style: 'width:100%;height:300px;'
}, domConstruct.create('div'));
container.startup();
//delay then resize
setTimeout(function() {
container.resize();
}, 200);
// add the attributes table
container.addChild(new ContentPane({
title: 'Attributes',
content: formatters.attributeList(data)
}));
// iterate over each relationship and add it
relationships.forEach(function(relationship){
container.addChild(new RelationshipTable(lang.mixin({
//pass attributes to the constructor so it queries automatically
attributes: data.attributes,
//pass a title for the tab container
title: 'Related Records',
//make sure it fills it completely
style: 'width:100%;'
}, relationship)));
});
return container.domNode;
};
}
@cmccullough2
Copy link

I am very interested in displaying relationship table information in my CMV. Am I creating a new widget for the modified relationship function.js or editing the identify widgetto make this capability work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment