wmbeers / cmv-app

CMV - The Configurable Map Viewer - A community supported open source mapping framework built with the Esri JavaScript API and the Dojo Toolkit
https://demo.cmv.io/
MIT License
1 stars 2 forks source link

Identify Widget addLayerInfo method isn't handling feature layers correctly #36

Closed wmbeers closed 3 years ago

wmbeers commented 4 years ago

This block of code in the addLayerInfo method of the Identify widget has a flaw: // If is a feature layer that does not support // Identify (Feature Service), create an // infoTemplate for the graphic features. Create // it only if one does not already exist. if (layer.capabilities && array.indexOf(layer.capabilities.toLowerCase(), 'data') < 0) {

The layer.capabilites returned from ArcGIS Server is a comma-separated string, not an array. array.indexOf will always return -1.

I recommend changing it to: if (layer.capabilities && layer.capabilities.toLowerCase().indexOf('data') < 0) {

The end result is that an unnecessary block of code is run to create new infotemplates from the REST service endpoint for the layer, not from the data already returned by the features. This became apparent when Lex noted that results for one service didn't include links. The data had the links, but the rest endpoint list of fields for the layer did not, so it wasn't in the info template, and thus the links aren't shown, even though they're there in the feature's (graphic object) attributes.

wmbeers commented 4 years ago

Fixed in 3a768dd1695fb59618dc26be48cc3bf34abad7c0.

wmbeers commented 3 years ago

This is done, will be deployed later as it's a trivial issue now that the services have been refreshed. (Also can't fully test it because the conditions that made it apparent has been resolved server side.)