problem with Legend when subclassing esri.layers.ArcGISDynamicMapServiceLayer

585
4
07-21-2011 10:01 AM
MichaelPorter1
New Contributor III
I created a subclass of ArcGISDynamicMapServiceLayerEx using the dojo.declare() method.  Everything works great but when I add it to the Legend, the Legend will not recognize it.  Any thoughts on a work around?

Thanks.
0 Kudos
4 Replies
derekswingley1
Frequent Contributor
The doc for the legend dijit lists the supported legend types:
The legend supports the following layer types: ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, FeatureLayer. If the layer is an ArcGISDynamicMapServiceLayer or ArcGISTiledMapServiceLayer created using ArcGIS Server 10.0 SP1 or higher the legend is generated using the REST Map Service legend resource.


KMLLayers are also supported. We'll update the doc to reflect this.
0 Kudos
MichaelPorter1
New Contributor III
Thanks Derek.

The problem is that even though a subclass of ArcGISDynamicServiceLayer is still an instanceof ArcGISDynamicServiceLayer, the Legend will not recognize it.  This does not make sense because the subclass will implement all of the same behaviors, etc.
0 Kudos
derekswingley1
Frequent Contributor
I understand, but at v2.4, you're limited to the classes I listed above. What are you doing in your custom class?
0 Kudos
MichaelPorter1
New Contributor III
A lot of it has to do with representing the class in object form for a table of contents.  I worked around it by adding to esri.layers.ArcGISDynamicMapServiceLayer.prototype, although this is probably not the best solution.

Thanks.
0 Kudos