[GIS] GeoExt (ExtJS + OpenLayers) not displaying Google Map

ext-jsgeoextgoogle mapsopenlayers-2

I've just started exploring GeoExt. It displays all the map controls, Google Logo and "Terms of Use". But the map is not rendered. I'm using firebug, and no JavaScript errors are generated. I'm using ext 3.4, OpenLayers 2.11, and GeoExt 1.1.

    <link rel="stylesheet" type="text/css" href="libs/ext/resources/css/ext-all.css">
    <script type="text/javascript" src="libs/ext/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="libs/ext/ext-all.js"></script>
    <script src="libs/openlayers/lib/OpenLayers.js"></script>
    <script type="text/javascript" src="libs/geoext/lib/GeoExt.js"></script>
    <script src="http://maps.google.com/maps/api/js?sensor=false"
            type="text/javascript"></script>

    <script type="text/javascript">

    Ext.BLANK_IMAGE_URL = "ext/resources/images/default/s.gif";
    var app, items = [], controls = [];

    Ext.onReady(function() {
        app = new Ext.Viewport({
            layout: "border",
            items: items
        });
    });

    items.push({
        xtype: "gx_mappanel",
        ref: "mapPanel",
        region: "center",
        map: {
            numZoomLevels: 20,
            controls: controls
        },
        extent: OpenLayers.Bounds.fromArray([
            -122.911, 42.291,
            -122.787,42.398
        ]),
        layers: [new OpenLayers.Layer.Google(
                'Google Streets',
                {isBaseLayer: true}
        )]
    });
    controls.push(
        new OpenLayers.Control.Navigation(),
        new OpenLayers.Control.Attribution(),
        new OpenLayers.Control.PanPanel(),
        new OpenLayers.Control.ZoomPanel()
    );

    </script>
</head>
<body>
</body>

Any assistance will be appreciated.

Best Answer

Following the tutorials and source code at http://www.geoext.org/examples.html#examples, I was able to get a Google Map working. My working code is shown below. Any further advice are still welcome. I guess I was using an outdated syntax.

           var mapPanel, controls = [];

        Ext.onReady(function() {
            Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
            var map = new OpenLayers.Map();
            var layer = new OpenLayers.Layer.Google(
                    'Google Streets',
                    {numZoomLevels: 20},
                    {visibility: true}
            );

            map.addLayers([layer]);
            map.addControls(controls);

            mapPanel = new GeoExt.MapPanel({
                title: "GeoExt MapPanel",
                renderTo: "mappanel",
                stateId: "mappanel",
                height: "100%",
                width: "100%",
                map: map,
                center: new OpenLayers.LonLat(5, 45),
                zoom: 4,
                // getState and applyState are overloaded so panel size
                // can be stored and restored
                getState: function() {
                    var state = GeoExt.MapPanel.prototype.getState.apply(this);
                    state.width = this.getSize().width;
                    state.height = this.getSize().height;
                    return state;
                },
                applyState: function(state) {
                    GeoExt.MapPanel.prototype.applyState.apply(this, arguments);
                    this.width = state.width;
                    this.height = state.height;
                }
            });
        });

        controls.push(
                new OpenLayers.Control.Navigation(),
                new OpenLayers.Control.Attribution(),
                new OpenLayers.Control.PanPanel(),
                new OpenLayers.Control.ZoomPanel()
            );

        // functions for resizing the map panel
        function mapSizeUp() {
            var size = mapPanel.getSize();
            size.width += 40;
            size.height += 40;
            mapPanel.setSize(size);
        }
        function mapSizeDown() {
            var size = mapPanel.getSize();
            size.width -= 40;
            size.height -= 40;
            mapPanel.setSize(size);
        }

There is a <div id="mappanel"></div> in the <body></body> section.