Printapp.map = new esri.Map
center: [-102, 54.75],
But I already have other script basically to loop through a map service and show the layers with the map type, coordinates and layers on startup. Then I click print, it defaults to this instead of what's on the screen. I can change the zoom level, basemap map type etc. and it will print out the changes instead of what's showing on the screen.
If I comment this bit out, it doesn't work. Basically I just want the print function to print out what's on the current map screen. How do I do this?
No not at all. You said:
But I already have other script basically to loop through a map service and show the layers with the map type, coordinates and layers on startup.
So that tells me that somewhere in that code you Already have a map object that you need to passing to the Printapp.map.
Yes, it's in a different script, one that loops through the mapserver and loads all the layers - my question is how exactly do I get my print script to reference this looping script? I don't want it loading a new map underneath so I assumed if I commented it out it would automatically reference the looping script, but that hasn't worked. I have about 8,9 pther scripts and I need them to all play nicely with each other without breaking anything.
So you have to open this print script from your main app script right? So when you do you pass in the map object from the main script or you set a window level variable for the map object and reference that window level var from the print script.
Hi Biraja, that approach doesn't work. Programmatically, I need this print script to reference the current map view that is provided by another script and I don't know how to do this with js. An example would help me out a lot. The example you've provided is just the print script in isolation which I've already gone through.
Sorry you are having such a hard time with this. If you could provide your code then I can guide you on how to do this as it should not be complicated.