Thanks for steering me in the right direction John, it's very much appreciated!
It's mostly working for me now, but dates are being a problem as the popupInfo.fieldInfos "dateFormat" defined is not being applied. Dates are always being formated as an America date & time rather than the "dayShortMonthYear" defined for the field. All other formats seem to get applied without issue though e.g. number of decimal places for numeric values.
Here's the relevant code being used under the AngularJS framework:
function onLayerChanged(layer, esri) {
_graphic = new esri.Graphic({ // esri/Graphic
popupTemplate: {
content: layer.popupInfo ? layer.popupInfo.description : '',
fieldInfos: layer.popupInfo ? layer.popupInfo.fieldInfos : null
}
});
}
function onFeaturesChanged(features, esri) {
_this.parsedFeatures.length = 0;
_this.parsedFeatures = _.map(features,
function (feature) {
var div = document.createElement('div');
_graphic.attributes = feature.attributes;
var featureWidget = new esri.Feature({ // esri/widgets/Feature
graphic: _graphic,
container: div
});
featureWidget.renderNow();
return {
id: feature.uid,
html: div.outerHTML
};
});
}
This is the popupInfo.description being used from the layer:
"<b>Title No:</b> {TitleNo}<br /><b>Owner names:</b> {Owners}<b><br />Type:</b> {Type}<br /><b>Land District:</b> {LandDistrict}<br /><b>Issue Date:</b> {IssueDate}<br /><b>Guarantee Status:</b> {GuaranteeStatus}<br /><b>Estate Description:</b> {EstateDescription}<br /><b>Area:</b> {AREA_HA} ha"
Here are the relevant popupInfo.fieldInfos from the layer:
Original output html when we were taking the popupInfo.description and populating the attributes manually, without any formatting (html template does not include blue title area):
And more advanced html output using esri/widgets/Feature and code above (html template does not include blue title area):
As you can see, the Area numeric value is being formatted as defined in popupInfo.fieldInfos, but the Issue Date is not respecting the "dayShortMonthYear" format defined. Any ideas what I might be doing wrong? Perhaps none of the defined formats are being applied and it's all default formatting?