Skip to content

Commit

Permalink
fix dynamic layer identifies for sublayerid 0 add example with layer …
Browse files Browse the repository at this point in the history
…0 add formatter example
  • Loading branch information
green3g committed Mar 29, 2017
1 parent f18a8d2 commit 64b0a2f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
15 changes: 15 additions & 0 deletions viewer/js/config/identify.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ define([
// for details on pop-up definition see: https://developers.arcgis.com/javascript/jshelp/intro_popuptemplate.html

identifies: {
population: {
0: {
fieldInfos: [{
visible: true,
fieldName: 'Pixel value',
alias: 'Population'
}, {
visible: true,
fieldName: 'Rounded Value',
formatter: function (none, attrs) {
return Math.round(attrs['Pixel value'] * 100) / 100;
}
}]
}
},
louisvillePubSafety: {
2: {
title: i18n.identify.louisvillePubSafety.policeStation,
Expand Down
1 change: 1 addition & 0 deletions viewer/js/config/nls/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ define({
},
viewer: {
operationalLayers: {
population: 'Population density',
damageAssessment: 'Damage Assessment',
louisvillePubSafety: 'Louisville Public Safety',
restaurants: 'Restaurants',
Expand Down
7 changes: 7 additions & 0 deletions viewer/js/config/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ define([
iconClass: 'fa fa-smile-o'
}]
}
}, {
type: 'dynamic',
url: 'https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer',
title: i18n.viewer.operationalLayers.population,
options: {
id: 'population'
}
}, {
type: 'dynamic',
url: 'https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyOperationalLayers/MapServer',
Expand Down
2 changes: 1 addition & 1 deletion viewer/js/gis/dijit/Identify.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ define([
getInfoTemplate: function (layer, layerId, result) {
var popup, config;
if (result) {
layerId = result.layerId || layer.layerId;
layerId = typeof result.layerId === 'number' ? result.layerId : layer.layerId;
} else if (layerId === null) {
layerId = layer.layerId;
}
Expand Down

0 comments on commit 64b0a2f

Please sign in to comment.