AnsweredAssumed Answered

Detach and reattach a map view to a container

Question asked by tj.rockefeller on Jul 5, 2017
Latest reply on Jul 6, 2017 by tj.rockefeller

I am working on an application with a dynamic layout, and I would like to be able to close (remove) the map from the page, and then later reattach the map that was removed to a new HTML container.

 

for detaching from the page I was trying

 

    view.container = null;

 

for reattaching to the page I am just assigning the HTMLDivElement to the container

 

    view.container = divContainerElement;

 

When I do this it just kind of works. The widgets that I have set up on the view show up in my container, but the actual map is not shown.

 

The main difference that I can see in the html is that when the map is initially added there are several child elements inside of <div class="esri-view-surface"... , and after I detach and reattach then the element <div class="esri-view-surface"... has no child elements.

 

Is what I'm talking about even possible, or is it something that will be available in a future release?

 

I am using arcgis-js-api 4.3.1

 

A fiddle with a very basic setup of what I'm trying to do is here Edit fiddle - JSFiddle 

 

If you press the detach button it will remove the map, and when you reattach you will see that the map kind of comes back with the zoom widget visible and the footer information visible, but no map.

 

Thanks for any help.

Outcomes