Select to view content in your preferred language

Failed to add a graphicsLayer

702
1
Jump to solution
01-31-2014 06:43 AM
ShaningYu
Honored Contributor
Got a failure to add a graphicsLayer on the map.  This piece of code worked well several days ago.  I don't know why it breaks.  The related code is below:
          var queryFeatures = featureSet.features;
          for (var i = 0; i < queryFeatures.length; i++) {
              queryFeatures.setSymbol(querySymbol);
              gLayer.add(queryFeatures);
          }
          map.addLayers([gLayer]);

When I run debugging, at  map.addLayers([gLayer]);  I can view that the gLayer (GraphicsLayer) does have 27 records.  After I press F10 to continue the debugging, it shows
catch(g)        g - undefined
Hopefully, I can get a hint from you.  Thanks in advance.
0 Kudos
1 Solution

Accepted Solutions
ShaningYu
Honored Contributor
Looks to be a simple and stupid mistake I had: I commented out        dojo.require("esri.layers.GraphicsLayer");
Removed the //, the error was gone.

View solution in original post

0 Kudos
1 Reply
ShaningYu
Honored Contributor
Looks to be a simple and stupid mistake I had: I commented out        dojo.require("esri.layers.GraphicsLayer");
Removed the //, the error was gone.
0 Kudos