Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / examples / window / gmap.js
1 /*
2
3 This file is part of Ext JS 4
4
5 Copyright (c) 2011 Sencha Inc
6
7 Contact:  http://www.sencha.com/contact
8
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file.  Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
11
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
13
14 */
15 Ext.Loader.setConfig({enabled: true});
16 Ext.Loader.setPath('Ext.ux', '../ux');
17 Ext.require([
18     'Ext.window.*',
19     'Ext.ux.GMapPanel'
20 ]);
21
22 Ext.onReady(function(){
23     var mapwin;
24     
25     Ext.get('show-btn').on('click', function() {
26         // create the window on the first click and reuse on subsequent clicks
27         if(!mapwin){
28
29             mapwin = Ext.create('Ext.Window', {
30                 layout: 'fit',
31                 title: 'GMap Window',
32                 closeAction: 'hide',
33                 width:450,
34                 height:450,
35                 border: false,
36                 x: 40,
37                 y: 60,
38                 items: {
39                     xtype: 'gmappanel',
40                     zoomLevel: 14,
41                     gmapType: 'map',
42                     mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
43                     mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],
44                     setCenter: {
45                         geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',
46                         marker: {title: 'Fenway Park'}
47                     },
48                     markers: [{
49                         lat: 42.339641,
50                         lng: -71.094224,
51                         marker: {title: 'Boston Museum of Fine Arts'},
52                         listeners: {
53                             click: function(e){
54                                 Ext.Msg.alert({title: 'Its fine', text: 'and its art.'});
55                             }
56                         }
57                     },{
58                         lat: 42.339419,
59                         lng: -71.09077,
60                         marker: {title: 'Northeastern University'}
61                     }]
62                 }
63             });
64             
65         }
66         
67         mapwin.show();
68         
69     });
70     
71  });