I have created an HTML template to open from my existing arcgis JavaScript application. The HTML template is to be populated with several maps and text based on a user selection of the main app. My question is, what is the best way to go about copying the same graphics and basemaps from the main application to the new window? My current code adds a new map and I am able to add the basemap as a layer, but it is removed in the main application. I also have not been able to add the graphic layer, although i get no errors when I add to the maps of the new windows.
here is my current code:
var center_left = (screen.width / 2) - (1100 / 2); var center_top = (screen.height / 2) - (600 / 2); var adminWindow = window.open('', '_blank', 'width=1100,height=600,menubar=yes,scrollbars=yes,left=' + center_left + ',top=' + center_top); var adminDoc = adminWindow.document; var adminBody = adminDoc.body; adminDoc.write(adminReportTemplate); adminDoc.close(); var parcelTable = this.getParcelTable(); adminDoc.getElementById('parcelTable').innerHTML = parcelTable; var parcelExtent = this.results.features[0].geometry.getExtent(); var basemapLayer = this.map.getLayer(this.map.layerIds[0]); var parcelGraphic = this.map.getLayer(this.map.graphicsLayerIds[8]); var parcelMap = new Map(adminDoc.getElementById('parcelMap'), { extent: parcelExtent, basemap:basemapLayer // Error: Map.setBasemap: Unable to add basemap: "". }); parcelMap.addLayer(basemapLayer); //works but removes basemap from this.map parcelMap.graphics.add(parcelGraphic); //no graphics visible, no error
أكثر...
here is my current code:
var center_left = (screen.width / 2) - (1100 / 2); var center_top = (screen.height / 2) - (600 / 2); var adminWindow = window.open('', '_blank', 'width=1100,height=600,menubar=yes,scrollbars=yes,left=' + center_left + ',top=' + center_top); var adminDoc = adminWindow.document; var adminBody = adminDoc.body; adminDoc.write(adminReportTemplate); adminDoc.close(); var parcelTable = this.getParcelTable(); adminDoc.getElementById('parcelTable').innerHTML = parcelTable; var parcelExtent = this.results.features[0].geometry.getExtent(); var basemapLayer = this.map.getLayer(this.map.layerIds[0]); var parcelGraphic = this.map.getLayer(this.map.graphicsLayerIds[8]); var parcelMap = new Map(adminDoc.getElementById('parcelMap'), { extent: parcelExtent, basemap:basemapLayer // Error: Map.setBasemap: Unable to add basemap: "". }); parcelMap.addLayer(basemapLayer); //works but removes basemap from this.map parcelMap.graphics.add(parcelGraphic); //no graphics visible, no error
أكثر...