Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / examples / window / gmap.js
1 /*!
2  * Ext JS Library 3.0.3
3  * Copyright(c) 2006-2009 Ext JS, LLC
4  * licensing@extjs.com
5  * http://www.extjs.com/license
6  */
7 \r
8 Ext.onReady(function(){\r
9 \r
10     var mapwin;\r
11     var button = Ext.get('show-btn');\r
12 \r
13     button.on('click', function(){\r
14         // create the window on the first click and reuse on subsequent clicks\r
15         if(!mapwin){\r
16 \r
17             mapwin = new Ext.Window({\r
18                 layout: 'fit',\r
19                 title: 'GMap Window',\r
20                 closeAction: 'hide',\r
21                 width:400,\r
22                 height:400,\r
23                 x: 40,\r
24                 y: 60,\r
25                 items: {\r
26                     xtype: 'gmappanel',\r
27                     region: 'center',\r
28                     zoomLevel: 14,\r
29                     gmapType: 'map',\r
30                     mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],\r
31                     mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],\r
32                     setCenter: {\r
33                         geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',\r
34                         marker: {title: 'Fenway Park'}\r
35                     },\r
36                     markers: [{\r
37                         lat: 42.339641,\r
38                         lng: -71.094224,\r
39                         marker: {title: 'Boston Museum of Fine Arts'},\r
40                         listeners: {\r
41                             click: function(e){\r
42                                 Ext.Msg.alert('Its fine', 'and its art.');\r
43                             }\r
44                         }\r
45                     },{\r
46                         lat: 42.339419,\r
47                         lng: -71.09077,\r
48                         marker: {title: 'Northeastern University'}\r
49                     }]\r
50                 }\r
51             });\r
52             \r
53         }\r
54         \r
55         mapwin.show();\r
56         \r
57     });\r
58     \r
59  });