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