There's a demo on the GeoExt site that's really similar to your question,
http://dev.geoext.org/trunk/geoext/examples/mappanel-viewport.js

Very near the top of that javascript code, above the "Ext.onReady(function() ", they define var mapPanel. That should take care of mapPanel not being defined.

- Ryan

On 9/1/2010 2:19 PM, Robert Buckley wrote:
Hi,

I´ve been hitting my head against a wall all evening trying to get a treepanel
to work in a viewport.

I always get the error message Mappanel not defined!!...this is because mapPanel
is declared underneath the tree, but I can´t put the tree under the viewport
either.

It´s late and i´m lost. Can anyone help me out?

.....


this rest of the code just defines the grids and the layers.



.....
     var tree = new Ext.tree.TreePanel({
     region: "west",
     title: "Map Layers",
     width: 200,
     autoScroll: true,
     enableDD: true,
     lines: false,
     rootVisible: false,
     root: new GeoExt.tree.LayerContainer({
     layerStore: mapPanel.layers,
     expanded: true
     })

});

     new Ext.Viewport({
         layout: "border",
         items: [{
             region: "north",
             contentEl: "title",
             height: 50
         }, {
             region: "center",
             id: "mappanel",
             title: "Map",
             xtype: "gx_mappanel",
             map: map,
             layers: [gsat, mapnik,layer_wea, layer_zgbgrenze],
             minScale: 500000,
             maxScale: 100000,
             numZoomLevels: 2,
              center: [1169180, 6843865],
               zoom: 9,
             split: true
         }, {
             region: "west",
             title: "Karteninhalt",
             items:[],
             width: 200,
             split: true
         }, {
             region: "east",
             split: true,
             collapsed:true,
             collapsible:true,
             xtype: 'tabpanel',
             title: 'WEA',
             width: 500,
             items: [
             attribgridPanel_wea,attribgridPanel_gas,attribgridPanel_wasser
             ]

         }]
     });

    var mapPanel = Ext.getCmp("mappanel");

});


Thanks,

Rob



_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users


--
Ryan Williams, GISP
GIS Analyst / Programmer
PAQ Interactive Inc.
107 S State St., Suite 300
Monticello, IL 61856-1968

_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to