PDA

View Full Version : [OPEN-EXTJSIV-291] on activating a window the deactivate event fires



wsi
23 Mar 2011, 2:41 PM
Version: EXTJS 4.0 PR5

When a window is activated, the activate event fires as expected. However, the deactivate event is fired immediately right afterwards.

Code below is a modification of the gmap window example and can reproduce the error.


Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('Ext.ux', '../ux');
Ext.require([
'Ext.window.*',
'Ext.ux.GMapPanel'
]);

Ext.onReady(function(){
var mapwin;

Ext.get('show-btn').on('click', function() {
// create the window on the first click and reuse on subsequent clicks
if(!mapwin){

mapwin = Ext.create('Ext.Window', {
layout: 'fit',
title: 'GMap Window',
closeAction: 'hide',
animateTarget: Ext.get('show-btn'),
width:450,
height:450,
x: 40,
y: 60,
items: {
xtype: 'gmappanel',
zoomLevel: 14,
gmapType: 'map',
mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],
setCenter: {
geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',
marker: {title: 'Fenway Park'}
},
markers: [{
lat: 42.339641,
lng: -71.094224,
marker: {title: 'Boston Museum of Fine Arts'},
listeners: {
click: function(e){
Ext.Msg.alert({title: 'Its fine', text: 'and its art.'});
}
}
},{
lat: 42.339419,
lng: -71.09077,
marker: {title: 'Northeastern University'}
}]
}
});

}

var count = 0;
mapwin.on('activate', function(){ console.log('window activated '+count); count++; });
mapwin.on('deactivate', function(){ console.log('window deactivated '+count); count++; });

mapwin.show();


});

});






I am assuming that this section of code is causing the problem.

File: ext-all-debug.js
Lines 6218 - 6245




_activateLast: function(justHidden) {
var comp,
lastActivated = false,
i;




for (i = this.accessList.length-1; i >= 0; --i) {
comp = this.accessList[i];
if (!comp.hidden) {
if (!lastActivated) {
this._setActiveChild(comp);
lastActivated = true;
}


if (comp.modal) {
this._showModalMask(comp.el.getStyle('zIndex') - 4);
return;
}
}
}


this._setActiveChild(null); //<---- why is this line of code necessary? Is it suppose to be if(!lastActivated) then call this function?

this._hideModalMask();
},