AnsweredAssumed Answered

Is esri.dijit.Legend.destroy() destroying everything?

Question asked by myESRIUName on Oct 5, 2012
Latest reply on Oct 9, 2012 by myESRIUName
In my application, the Legend digit is displayed in a window panel that the user can open and close at their discretion. This application also has a ArcGISDynamicMapServiceLayer whose symbology can be specified by the user using the esri.tasks.GenerateRendererTask. Given the following scenario, the Legend does not get updated properly.

Assume that I have generated a renderer with esri.tasks.ClassBreaksDefinition and specified 5 breaks. The map is displayed as I wish it to be. I open my legend window, which instantiates the esri.dijit.Legend and calls its startup(). I can see that it sends the legend REST request to the ArcGISDynamicMapServiceLayer and the Legend dijit displays the correct symbology for the map as it is currently shown...with 5 classes.

Now, I close the legend window and, in so doing, the code calls the esri.dijit.Legend's destroy() and I set its variable to null. Then, I change the display of the map and specify, say, 10 breaks. The map displays as desired (with 10 classes now) and then I open my legend window again (which, instantiates a new Legend dijit and calls  startup() again). This time, though, the legend it shows me for that service will still show the 5 classes it generated the last time I opened it. And, no new legend REST request was sent to the ArcGISDynamicMapServiceLayer.

It's as though something is still in memory and whatever it is indicates to the dijit's code somehow that nothing has changed in the display since the last time the legend was drawn.

Can anyone suggest anything that could be causing this behaviour? Is there something further I can clear or free when I destroy the Legend dijit to ensure that the next time a Legend dijit is created and started within the same session it is not referencing some information that is now out of date?

Cheers,
jtm

Outcomes