Odd behavior with two maps in separate windows (tabs) - seeing each others nav events

610
6
10-13-2011 06:42 AM
JeffPace
MVP Alum
I am trying to make a interactive print page

in my primary app, i set some global variables with extent, layers, graphics, etc..
i then call
window.open("print.html","PrintWindow");

print.html is an interactive map template.   its init function is

function init() {
   //     esriConfig.defaults.map.sliderLabel = null;
      //  var startExtent = new esri.geometry.Extent({"xmin":-9228363.6,"ymin":3140074.58,"xmax":-9116765.5,"ymax":3202141.45,"spatialReference":{"wkid":102100}});
        printpagemap = new esri.Map("printpagemap",{extent:opener.printMapExtent, logo:false});
        dojo.forEach(opener.printMapLayers, dojo.hitch(this, function(layer){
            printpagemap.addLayer(layer);
        }));
        dojo.forEach(opener.printGraphics.graphics, dojo.hitch(this, function(graphic){
            printpagemap.graphics.add(graphic);
        }));

 navToolbar = new esri.toolbars.Navigation(printpagemap);

      }


So the references to "opener" are the parent app.  This works great, except, as so as i do navigation on the print map, it destroys all navigation on the parent app, even though its in a new tab.
If i navigate on the parent app, the map the is updated is on the print page only!!! I.e. the zoom slider moves in on the parent app but its map does not update, the map in the other tab does!

also graphics become completely buggered.  My guess is i am cross naming somewhere, but since the printmap has a completely different id i thought the would be independent?

please help, thanks.
0 Kudos
6 Replies
JeffPace
MVP Alum
okay even more odd

even with navigation disabled on the new map (window.open), all navigation is broken on the parent and occurs on the child.  If i close the child tab it nukes my parent (map is null) .

anyone?
0 Kudos
KellyHutchins
Esri Frequent Contributor
We have similar functionality in the Basic Viewer template and I can't reproduce the issue there. Here's a link to an application built on the template.
http://apps.arcgis.com/hosted/OnePane/basicviewer/index.html?appid=6674f8465fc7479a91dffb366376e1cb


Do you have a url for your app?
0 Kudos
JeffPace
MVP Alum
Kelly,
Can you send me the source code? That is exactly what I want to do.
0 Kudos
KellyHutchins
Esri Frequent Contributor
You can download the source code on ArcGIS.com. Here's the link to the template, scroll down to the bottom and you'll find the download link in the Code Attachment section:
http://www.arcgis.com/home/item.html?id=89db99ee00834c85b3f9284d9e81c964
0 Kudos
JeffPace
MVP Alum
We have similar functionality in the Basic Viewer template and I can't reproduce the issue there. Here's a link to an application built on the template.
http://apps.arcgis.com/hosted/OnePane/basicviewer/index.html?appid=6674f8465fc7479a91dffb366376e1cb


Do you have a url for your app?


Well using your print page i was able to solve my issue, now I have to figure out why.

To do it, however, I had to use the
http://apps.arcgis.com/sharing/tools/print
page.  Am I allowed to do this, or can I get the code so I can host it locally?

Thank you.
0 Kudos
JeffPace
MVP Alum
Kelly,
I have this working nearly perfectly using the sample provided, however, does it not support graphics?  If i can get the graphics fixed, it would be a huge milestone for us.
0 Kudos