Hello, I posted this question on StackOverflow but did not get any response, maybe someone here can help? Thanks!My webapp allows the user to zoom to a map extent, then create a new window with a new map drawn to the zoomed extent of the parent window map. The parent map contains graphics, which should also be passed and added to the child window map. My problem is that the graphics do not draw in the child window until I refresh the page. Once I manually refresh, all the graphics are there in the right place. I have tried various ways of forcing a refresh of the map or layer using javascript but nothing has worked. Also, when I refresh the child page, the graphics disappear from the parent page. If anyone has ideas I would appreciate it, thanks. Code below (note, this code is for the child window, 'window.opener' refers to the parent window):
function drawCrosswalks()
{
updateLayerVisibility();
var locCrosswalkArray = [];
for (var i=0, l=window.opener.globalCrosswalkArray.length; i<l; i++)
{
locCrosswalkArray = window.opener.globalCrosswalkArray;;
// globalCrosswalkArray is a graphics array from the parent page)
}
if (locCrosswalkArray.length > 0)
{
for (var i = 0, il = window.opener.globalCrosswalkArray.length; i < il; i++)
{
var symbol;
var crossWalkG = window.opener.globalCrosswalkArray.feature;
symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([50, 205, 50]), 3), new dojo.Color([0, 0, 255, 0]));
crossWalkG.setSymbol(symbol);
printMap.graphics.add(crossWalkG);
}
} // end if
printMap.resize();
printMap.setExtent(printMap.extent) ;
schoolSafetyLayer.refresh(); // none of this worked
} // end func
The child window is created from the parent with this code:
\function printWindow()
{
newWindow = window.open ("blank.html");
if(newWindow.pageLoadStatus==true) {
console.log("true"); }
printXMax = map.extent.xmax;
printXMin = map.extent.xmin;
printYMax = map.extent.ymax;
printYMin = map.extent.ymin;
}