Sencha extjs4.0:无法加载GmapPanel

时间:2013-02-02 08:35:48

标签: javascript ajax extjs extjs4

Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('Ext.ux', '../ux');
Ext.require([
    'Ext.window.*',
    'Ext.ux.GMapPanel'
]);

Ext.onReady(function() {
    var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
        myMask.show();

        var layout = Ext.create('Ext.panel.Panel', {
            //renderTo: 'layout',
            width: window.innerWidth,
            height: window.innerHeight,
            //title: 'Border Layout', //no title will be blank
            layout: 'border',
            items: [{
                title: 'Message List',
                region: 'south',     // position for region
                xtype: 'panel',
                height: 100,
                split: true,         // enable resizing
                collapsible: true,
                margins: '0 5 5 5',
                collapsed: true
            },{
                //title: 'Map',
                region: 'center',    
                xtype: 'gmappanel',
                center: {geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',marker: {title: 'Fenway Park'}}
            }],
            renderTo: Ext.getBody() //get the body and display Layout at there
        }); 
        myMask.hide();
});

问题

  1. 为什么无法加载gmappanel?

  2. 我正在尝试显示加载蒙版,当页面完成加载时只删除加载蒙版?怎么做?

1 个答案:

答案 0 :(得分:0)

region: 'center',     // center region is required, no width/height specified
                xtype: 'gmappanel',
                id : 'mygooglemap',
                mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
                mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],   
                zoomLevel: 2,
                gmapType: 'map',
                center: {geoCodeAddr: 'Malaysia'}

尝试此代码适用于您或不适用。