Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / examples / window / gmap.js
1 /*!
2  * Ext JS Library 3.1.1
3  * Copyright(c) 2006-2010 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                     zoomLevel: 14,\r
28                     gmapType: 'map',\r
29                     mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],\r
30                     mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],\r
31                     setCenter: {\r
32                         geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',\r
33                         marker: {title: 'Fenway Park'}\r
34                     },\r
35                     markers: [{\r
36                         lat: 42.339641,\r
37                         lng: -71.094224,\r
38                         marker: {title: 'Boston Museum of Fine Arts'},\r
39                         listeners: {\r
40                             click: function(e){\r
41                                 Ext.Msg.alert('Its fine', 'and its art.');\r
42                             }\r
43                         }\r
44                     },{\r
45                         lat: 42.339419,\r
46                         lng: -71.09077,\r
47                         marker: {title: 'Northeastern University'}\r
48                     }]\r
49                 }\r
50             });\r
51             \r
52         }\r
53         \r
54         mapwin.show();\r
55         \r
56     });\r
57     \r
58  });