programmatically showing/hiding Overview map

809
3
Jump to solution
03-26-2012 03:08 AM
Salomon_VágadalJoensen
New Contributor III
I have a problem with hiding the Overview map once I've programmatically made it visible. I reckon it is how I refresh the Overview map with 'overviewMapDijit.startup()' since it shows in the console that it is set to be hidden, even though it's still visible. Might this be a bug or a refresh problem?

        dojo.connect(map, 'onLoad', function(theMap) {           // resize the map when the browser resizes           dojo.connect(dijit.byId('map'), 'resize', map,map.resize);                      // add the overview map      overviewMapDijit = new esri.dijit.OverviewMap({       NLS_drag: "flyt til at broyta kort ekstentið",    NLS_hide: "Goym yvirlitskortið",    NLS_show: "Vís yvirlitskortið",    map:map,    visible: false,    opacity: .25,       attachTo:"top-right",     color:"#FF0000",    expandFactor: 4  // kortið zoomar í mesta lagið 4 ferðir størri enn overview kortið vísur.     });                overviewMapDijit.startup();              var scalebar = new esri.dijit.Scalebar({             map: map,             scalebarUnit:'metric'           });         });      dojo.connect(map, "onZoomEnd", function(evt) {    if (map.extent.xmax - map.extent.xmin < 150000)    {     overviewMapDijit.visible = true;     overviewMapDijit.startup();    }        if (map.extent.xmax - map.extent.xmin > 150000)    {     overviewMapDijit.visible = false;     overviewMapDijit.startup();    }       });
0 Kudos
1 Solution

Accepted Solutions
derekswingley1
Frequent Contributor
The easiest way to handle this is to call destroy() on your overview map when you want to hide it and re-create it when you need to show it again.

Edit:  you can also use _show and _hide if you don't want to go the destroy/create route. We'll make these methods public (no underscore and we'll document them) in the next release.

View solution in original post

0 Kudos
3 Replies
DeryaBaysal
New Contributor
Hi

I have the same problem. Did you find a solution?
0 Kudos
derekswingley1
Frequent Contributor
The easiest way to handle this is to call destroy() on your overview map when you want to hide it and re-create it when you need to show it again.

Edit:  you can also use _show and _hide if you don't want to go the destroy/create route. We'll make these methods public (no underscore and we'll document them) in the next release.
0 Kudos
Salomon_VágadalJoensen
New Contributor III
overviewMapDijit._hide()  and overviewMapDijit._show() both work perfectly.

Thanks!
0 Kudos