koverby

Exception when using Graphic.setSymbol on a graphic not visible in current extent.

Discussion created by koverby on May 6, 2010
For reference, we are currently using the 1.5 stand-alone version of the JavaScript API.

I've encountered an issue using the setSymbol function on a graphic that is not visible in current view extent.

Specifically, I'm adding a polyline and then changing it's symbol inside a function that also contains some other functionality that marks the line as "selected".

If any part of the polyline is visible at the time setSymbol is called, the function completes.  However, if no part of the polyline is visible when setSymbol is called, and exception is triggered the and remainder of function that invokes setSymbol is not executed.

I've used Firebug to trace the stack as best I can and the issue seems to occur inside the Dojo library when the JavaScript API is performing enumeration of some kind.

I've got a couple of ideas on how I could avoid this issue by panning to ensure part of the line is visible or having the symbology for the line setup initially setup in the desired "selected" state.

Either way, I do think the library should correctly handle changing the symbol of a non-visible graphic.

Outcomes