Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
green3g committed Jan 10, 2017
2 parents d42140a + f636350 commit e4b3c5b
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions viewer/js/gis/dijit/Identify.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ define([
infoTemplate = this.getInfoTemplate(layer, layer.layerId);
if (infoTemplate) {
layer.setInfoTemplate(infoTemplate);
var fieldInfos = infoTemplate.info.fieldInfos;
var formatters = array.filter(fieldInfos, function (info) {
return (info.formatter);
});
if (formatters.length > 0) {
layer.on('graphic-draw', lang.hitch(this, 'getFormattedFeature', layer.infoTemplate));
}
return;
}
}
Expand Down Expand Up @@ -343,18 +350,23 @@ define([
return;
}
}
var feature = this.getFormattedFeature(result.feature);
var feature = this.getFormattedFeature(result.feature.infoTemplate, result.feature);
fSet.push(feature);
}, this);
}, this);
this.map.infoWindow.setFeatures(fSet);
},
getFormattedFeature: function (feature) {
array.forEach(feature.infoTemplate.info.fieldInfos, function (info) {
if (typeof info.formatter === 'function') {
feature.attributes[info.fieldName] = info.formatter(feature.attributes[info.fieldName], feature.attributes);
}
});
getFormattedFeature: function (infoTemplate, feature) {
if (feature.graphic) {
feature = feature.graphic;
}
if (feature && infoTemplate && infoTemplate.info) {
array.forEach(infoTemplate.info.fieldInfos, function (info) {
if (typeof info.formatter === 'function') {
feature.attributes[info.fieldName] = info.formatter(feature.attributes[info.fieldName], feature.attributes, lang.clone(feature.geometry));
}
});
}
return feature;
},
identifyError: function (err) {
Expand Down Expand Up @@ -682,4 +694,4 @@ define([
}, this);
}
});
});
});

0 comments on commit e4b3c5b

Please sign in to comment.