<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#40007f;"><div>Hi,<br><br>I am trying to get the reference to the "map" in a geoext viewport in order to print the displayed "map" in a new window, but keep getting "undefined" in firebug<br><br>I have tried document.getElementById('map').innerHTML and also Ext.getCmp("map") as well as this.viewport.mapPanel.map and combinations of them all, but the result is always the same.<br><br>I´m sure one of you Javascript gurus will find this easy.<br><br>my code for the viewport is...<br><br>new Ext.Viewport({<br> id:"viewport",<br> layout: "border",<br> items: [{<br> region:
"center",<br> id: "mapPanel",<br> xtype: "gx_mappanel",<br> map: map,<br> layers: [mapnik,layer,vr_wea,ZGB_Grenze],<br> zoom: 7,<br>
split: true<br> bbar: [mapLinkButton,<br> {<br> text:"print",<br> icon: '../images/printer.png',<br> handler: function(){<br> <br> Ext.Msg.prompt('Map Title', 'Please
enter map title:', function(btn, text){<br> if (btn == 'ok'){<br> title = text;<br> var a = window.open('', '', 'width=650px,height=400px');<br> a.document.open("text/html");<br> a.document.write("<html><body>"+document.getElementById('map').innerHTML + "</body></html>");<br> a.document.close();<br>
a.print();<br> }<br> });<br> }<br> <br> <br> }],<br>
tbar: [toolbarItems, '->', quickzoom],<br> },InfoPanel]<br> });<br><br><br>I´d be grateful for any help,<br><br>yours,<br><br>Rob<br></div>
</div></body></html>