Trouble getting map object to refresh after resetting visible layers

580
1
05-18-2012 06:49 AM
DanielNieto_Jr
New Contributor
I am having issues getting the 'map' object to refresh after resetting the layer visiblity with 'setVisibleLayers' function.  After updating the layer visibility if you inspect the map object and do a .getLayer().visibleLayers it'll still have the old layer data in there even though the map no longer shows these layers.  I need only the current visible layers, is there a better place to get this information than the map object?
0 Kudos
1 Reply
DonSaul
New Contributor II
Hi, I don't know if this is the exact same bug that I encountered, but it sounds similar in nature.  Where I saw it was after a scale change event and I wanted to toggle visibility.  The bug was introduced in ver 2.6 and is still in the 2.8 version.  I am told it has been fixed for the next release.

I had to add "navigationMode" to my map object:

var map = new esri.Map('mapDiv', {
        displayGraphicsOnPan: !dojo.isIE,
        lods: lods,
        extent: startExtent,
        slider: false,
        nav: true,
        navigationMode: 'classic', // Fixes an ESRI bug introduced at 2.6, toggling layers on/off at a scale change.
        logo: true
    });

Good luck,
Don
0 Kudos