PDA

View Full Version : Ext.Map not firing activate event after setActiveItem



derickito
22 Sep 2011, 8:24 AM
Hi all,

I'm not sure if this is the right place to post this, but I've been banging my head against this bug for 2 days now. Hopefully is just something stupid that I'm missing. I have one fullscreen panel with 2 panels inside of it. The first panel is just a panel with some text on it and the other one is an Ext.Map panel. As the title says the Ext.Map panel has an activate listener and for some reason the first time this panel is shown using setActiveItem the activate event doesn't get fired. This only happens on iOS for me (test on iPad 1 [fw 4.3.3] and iPhone 4 [fw 4.2.1] and not on Chrome on my PC. That's the biggest reason why it's so hard to debug.
I have made the simplest example I could think of you can find it here: http://scriptprojects.com/test2.html

I will also include the code below:

var fullpanel, mappanel = new Ext.Map({
mapOptions: {
zoom: 13,
mapTypeId: google.maps.ROADMAP,
center: new google.maps.LatLng(29.74887,-95.36201)
},
listeners: {
activate: function(){ console.log('map activate'); }
}
});

var mainpanel = new Ext.Panel({
html: 'Hello World!',
});

function test(){
fullpanel.setActiveItem(mappanel, 'slide');
}

function test2(){
fullpanel.setActiveItem(mainpanel, 'slide');
}

Ext.setup({
phoneStartupScreen: 'images/launchimage.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {
fullpanel = new Ext.Panel({
fullscreen: true,
layout: 'card',
items: [mainpanel, mappanel],
dockedItems: [{
xtype: 'toolbar',
items: [{xtype: 'button', text: 'Test', handler: test}, {xtype: 'button', text: 'Back', handler: test2}]
}],
listeners: {
cardswitch: function(){ console.log('switch cards '+arguments[1].id); }
}
});
}
});

chemicaloli
12 Oct 2011, 8:27 AM
I have a similar issue. I call a panel with a map in it via a dispatcher and it works perfectly the first 2 times the panel is dispatched then fails the call the activate handler the third time. After the 3rd time it will fail every other time, so the 4th dispatch will work, the 5th will fail, the 6th will work and so on.

It works perfectly in Chrome but is buggy on my iPad (4.3.3)