PDA

View Full Version : Map in Panel



Voles
24 Mar 2011, 2:47 PM
Hi all,

I'm having problems with a Panel that disappears if I put in in a TabPanel.
If I show only the panel, it works. But when I put the Panel in the TabPanel, it seems like the Panel disappears (I'm working with Google Maps, and can't see the map).

Hope someone can help me?!

Thanks in advance!

This is my TabPanel:


Stick.views.MainPanel = Ext.extend(Ext.TabPanel, {
ui: 'toolbar',
tabBar: new Ext.TabBar({
dock: 'bottom',
height: 93
}),
items:
[
{
title: 'Kaart',
items: [
new Stick.views.Map()
]
},
{
title: 'Route',
items: [
new Stick.views.Map()
]
},
{
title: 'Reviews',
badgeText: 1,
items: [
new Stick.views.Map()
]
}
]
});

Ext.reg('stick-mainpanel', Stick.views.MainPanel);


And this is the Map:


Stick.views.Map = Ext.extend(Ext.Panel,
{
layout: 'fit',

initComponent: function ()
{
// store is ready
if (Stick.storesLoaded)
{
// map
var map = new Ext.Map({
fullscreen: true,
title: 'Map',
getLocation: true,
mapOptions:
{
zoom: 15
},
useCurrentLocation: true
});

Stick.stores.sightstore.each(function (e){
console.log(Stick.configs.iconUrls + e.data.category_slug + '.' + e.data.category_extention);

var position = new google.maps.LatLng(e.data.lat, e.data.lon);

var marker = new google.maps.Marker({
map: map.map,
position: position,
icon: Stick.configs.iconUrls + e.data.category_slug + '.' + e.data.category_extention
});

});

var list = new Ext.List({
items: [
"a",
"b",
"c"
]
});

// items
this.items = [map, list];
}

Stick.views.Map.superclass.initComponent.apply(this, arguments);
}
});