<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
There's a demo on the GeoExt site that's really similar to your
question,<br>
<a
href="http://dev.geoext.org/trunk/geoext/examples/mappanel-viewport.js">http://dev.geoext.org/trunk/geoext/examples/mappanel-viewport.js</a><br>
<br>
Very near the top of that javascript code, above the
"Ext.onReady(function() <span class="Apple-style-span"
style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"></span>
", they define var mapPanel. That should take care of mapPanel not
being defined.<br>
<br>
- Ryan<br>
<br>
On 9/1/2010 2:19 PM, Robert Buckley wrote:
<blockquote cite="mid:716913.26299.qm@web24105.mail.ird.yahoo.com"
type="cite">
<pre wrap="">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
<a class="moz-txt-link-abbreviated" href="mailto:Users@geoext.org">Users@geoext.org</a>
<a class="moz-txt-link-freetext" href="http://www.geoext.org/cgi-bin/mailman/listinfo/users">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Ryan Williams, GISP
GIS Analyst / Programmer
PAQ Interactive Inc.
107 S State St., Suite 300
Monticello, IL 61856-1968
</pre>
</body>
</html>