Hello,
I am working on a widget that adds geocoded points from an RSS Feed to a GraphicsLayer and then adds that GraphicsLayer to the map using code similar to this:
hGraphics = new esri.layers.GraphicsLayer({ "id": "highlights","displayOnPan": true,"opacity": "1.0", "title":"RSS Feed" });
this.map.addLayer(hGraphics)...
(for each point)
...var symbol = new esri.symbol.PictureMarkerSymbol("widgets/RSSFeed/images/RSS-logo_25.png", 25, 25);
var x = node[0][1];
var y = node[0][0];
var graphic = new Graphic(new Point(x, y), symbol, attr, infoTemplate);
hGraphics.add(graphic);
The points get added to the map correctly, the only problem is that since the layer is a GraphicsLayer, the LayerList widget does not automatically add the newly GraphicsLayer to the list of layers which can be toggled.
Inside the Widget.js file of the LayerList widget, there is a function called "_onLayerInfosChanged" which updates the layers list when different type of layer like the ArcGISDynamicMapServiceLayer gets added to the map. This function is not called when my GraphicsLayer is added.
From what figure there are two options: either create a different type of layer and add the points to it, like a FeatureLayer OR configure the LayerList widget to treat a GraphicsLayer as a normal layer. I am yet to get either of these options working.
Any Ideas?
Thanks,
Nat