Created
January 26, 2017 17:01
-
-
Save green3g/f0a85ed8f7111392618990c8398b4c15 to your computer and use it in GitHub Desktop.
multiple relationships in an identify popup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
] | |
) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?