I'm using the ArcGIS Map API "Historic_National_Boundaries_NEW (FeatureServer)> Year_2000" present over here :
It has two pre-defined fields 'OBJECTID' and 'NAME_2' (for each country) which are displayed onclick of a country in map. I'm using PopupTemplate() object to create the popup.
//on-click popup functionality starts
var popupOptions = {
markerSymbol: new SimpleMarkerSymbol("circle", 32, null,
new Color([0, 0, 0, 0.25])),
marginLeft: "20",
marginTop: "20"
};
var popup = new Popup(popupOptions, domConstruct.create("div"));
var popupTemplate = new PopupTemplate({
title: "{NAME_2}",
fieldInfos: [
{
fieldName: "NAME_2",
visible: true,
label: "Country: ",
},
{
fieldName: "OBJECTID",
visible: true,
label: "ID: ",
}
],
showAttachments: true
});
I need to know if these fields can be customized or new fields can be added. I checked through the documentation but was not able to find any info. It mentioned adding fields, media elements and plain text but not external content or any method to manipulate the fields.
If fields cannot be manipulated, how can I display custom content (possibly fetched from JSON/XML file) in the popup for each country?
-
Does anyone know of any workarounds to this, please?cakerusk– cakerusk2016年12月06日 08:22:41 +00:00Commented Dec 6, 2016 at 8:22
1 Answer 1
in order to add new fields, you'd need to publish a service of your own. this can be accomplished either using our web based tools or desktop software.
http://doc.arcgis.com/en/arcgis-online/share-maps/add-items.htm
an alternative option would be to write your own clientside logic to manipulate the attributes of individual features from the existing service using your own JSON.
http://jsbin.com/bibalu/edit?html,output
featureLayer.on("graphic-add", function (e) {
e.graphic.attributes.FOO = 'bar';
})
new PopupTemplate({
title: "Custom",
description: "Foo: {FOO}"
});
Explore related questions
See similar questions with these tags.