Skip to content

Commit

Permalink
Merge pull request #706 from cmv/fix-675
Browse files Browse the repository at this point in the history
Fix dynamic layer identifies for sublayer id 0
  • Loading branch information
tmcgee authored Apr 12, 2017
2 parents 72a7b69 + b7032cd commit d46346b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
22 changes: 20 additions & 2 deletions viewer/js/config/identify.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
define([
'dojo/i18n!./nls/main',
'dojo/_base/lang'
], function (i18n, lang) {
'dojo/_base/lang',
'dojo/number'
], function (i18n, lang, number) {

var linkTemplate = '<a href="{url}" target="_blank">{text}</a>';
function directionsFormatter (noValue, attributes) {
Expand All @@ -10,6 +11,7 @@ define([
text: 'Get Directions'
});
}

return {
map: true,
mapClickMode: true,
Expand All @@ -34,6 +36,22 @@ define([
// for details on pop-up definition see: https://developers.arcgis.com/javascript/jshelp/intro_popuptemplate.html

identifies: {
cities: {
0: {
fieldInfos: [{
visible: true,
fieldName: 'CITY_NAME',
label: 'Name'
}, {
visible: true,
fieldName: 'POP',
label: 'Population',
formatter: function (value) {
return number.format(value);
}
}]
}
},
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: {
cities: 'World Cities',
damageAssessment: 'Damage Assessment',
louisvillePubSafety: 'Louisville Public Safety',
restaurants: 'Restaurants',
Expand Down
10 changes: 9 additions & 1 deletion viewer/js/config/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ define([
}
}, {
type: 'feature',
url: 'https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0',
url: 'https://sampleserver6.arcgisonline.com/ArcGIS/rest/services/SF311/FeatureServer/0',
title: i18n.viewer.operationalLayers.sf311Incidents,
options: {
id: 'sf311Incidents',
Expand Down Expand Up @@ -224,6 +224,14 @@ define([
iconClass: 'fa fa-smile-o'
}]
}
}, {
type: 'dynamic',
url: 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer',
title: i18n.viewer.operationalLayers.cities,
options: {
id: 'cities',
visible: false
}
/*
//examples of vector tile layers (beta in v3.15)
}, {
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 d46346b

Please sign in to comment.