Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / gmap.html
1 <html>\r
2 <head>\r
3   <title>The source code</title>\r
4     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
5     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
6 </head>\r
7 <body  onload="prettyPrint();">\r
8     <pre class="prettyprint lang-js">\r
9 Ext.onReady(function(){\r
10 \r
11     var mapwin;\r
12     var button = Ext.get('show-btn');\r
13 \r
14     button.on('click', function(){\r
15         // create the window on the first click and reuse on subsequent clicks\r
16         if(!mapwin){\r
17 \r
18             mapwin = new Ext.Window({\r
19                 layout: 'fit',\r
20                 title: 'GMap Window',\r
21                 closeAction: 'hide',\r
22                 width:400,\r
23                 height:400,\r
24                 x: 40,\r
25                 y: 60,\r
26                 items: {\r
27                     xtype: 'gmappanel',\r
28                     region: 'center',\r
29                     zoomLevel: 14,\r
30                     gmapType: 'map',\r
31                     mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],\r
32                     mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],\r
33                     setCenter: {\r
34                         geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',\r
35                         marker: {title: 'Fenway Park'}\r
36                     },\r
37                     markers: [{\r
38                         lat: 42.339641,\r
39                         lng: -71.094224,\r
40                         marker: {title: 'Boston Museum of Fine Arts'},\r
41                         listeners: {\r
42                             click: function(e){\r
43                                 Ext.Msg.alert('Its fine', 'and its art.');\r
44                             }\r
45                         }\r
46                     },{\r
47                         lat: 42.339419,\r
48                         lng: -71.09077,\r
49                         marker: {title: 'Northeastern University'}\r
50                     }]\r
51                 }\r
52             });\r
53             \r
54         }\r
55         \r
56         mapwin.show();\r
57         \r
58     });\r
59     \r
60  });</pre>    \r
61 </body>\r
62 </html>