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