gmap.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Ext.Loader.setConfig({enabled: true});
  2. Ext.Loader.setPath('Ext.ux', '../ux');
  3. Ext.require([
  4. 'Ext.window.*',
  5. 'Ext.ux.GMapPanel'
  6. ]);
  7. Ext.onReady(function(){
  8. var mapwin;
  9. Ext.get('show-btn').on('click', function() {
  10. // create the window on the first click and reuse on subsequent clicks
  11. if(mapwin) {
  12. mapwin.show();
  13. } else {
  14. mapwin = Ext.create('Ext.window.Window', {
  15. autoShow: true,
  16. layout: 'fit',
  17. title: 'GMap Window',
  18. closeAction: 'hide',
  19. width:450,
  20. height:450,
  21. border: false,
  22. x: 40,
  23. y: 60,
  24. items: {
  25. xtype: 'gmappanel',
  26. center: {
  27. geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',
  28. marker: {title: 'Fenway Park'}
  29. },
  30. markers: [{
  31. lat: 42.339641,
  32. lng: -71.094224,
  33. title: 'Boston Museum of Fine Arts',
  34. listeners: {
  35. click: function(e){
  36. Ext.Msg.alert('It\'s fine', 'and it\'s art.');
  37. }
  38. }
  39. },{
  40. lat: 42.339419,
  41. lng: -71.09077,
  42. title: 'Northeastern University'
  43. }]
  44. }
  45. });
  46. }
  47. });
  48. });