AnsweredAssumed Answered

Accessing featurelayer properties from an array of feature layers javascript api

Question asked by dar104 on Feb 25, 2015
Latest reply on Mar 3, 2015 by oearley

I am adding my feature layers to an array and map as follows:

         dojo.forEach(globals.layers, function (addit, i) {

                globals.featureLayers[i] = new FeatureLayer(addit.url, {

                    mode: addit.mode,


                    outFields: addit.outFields,

                    infoTemplate: addit.infoTemplate


                if (addit.type == "poly") {






This works fine and the layers needed display in the browser.  However, when I try to access the graphics array within the feature layer by doing the below in the above forEach statement:

               var graphicstmp = globals.featureLayers[i].graphics;

                console.log("Features Layer Properties in base ", graphicstmp)


I get an empty array in graphicstmp.  If I look at the globals.featureLayers[i] array in dev tools I see the graphics object there and it is not empty.  It has the properties for the layer that are displaying.  So apparently I am doing something wrong with trying to access it this way globals.featureLayers[i].graphics.  Help is appreciated.  I eventually want to modify some of the properties but I first need to be able to access them.