[Users] How to add a tree to a viewport?

Robert Buckley robertdbuckley at yahoo.com
Wed Sep 1 21:19:46 CEST 2010


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





More information about the Users mailing list