I am in the preliminary stages of developing a widget which will require me to reference a featurelayer. Testing how to loop through layers in the map and then pick out the one I want. I found and inserted the following code which, although it runs fine, does not list the featurelayer.
onOpen: function () {
console.log('onOpen');
for (var j = 0; j < this.map.layerIds.length; j++) {
var layer = this.map.getLayer(this.map.layerIds[j]);
console.log(layer.id + ' ' + layer.opacity + ' ' + layer.visible);
}
},
The code generates the following output:
postCreate
WidgetManager.js?wab_dv=2.10:114 widget [widgets/SelectAccidentDemo/Widget] created.
Widget.js?wab_dv=2.10:25 startup
Widget.js?wab_dv=2.10:42 onOpen
Widget.js?wab_dv=2.10:45 World_Street_Map_8421 1 true
Widget.js?wab_dv=2.10:45 AerialPhotos2017_8247 1 true
Widget.js?wab_dv=2.10:45 AGSPro_TileLayer_4565 1 true
Widget.js?wab_dv=2.10:67 onSignOut
All is great except it is missing the hosted featurelayer.
The map is linked here
The featurelayer shows up in the JSON when I log in to ArcGIS Online Assistant.
Thank you ahead of time for any help.