PDA

View Full Version : too many resize and afterlayout?



dolittle
31 Aug 2009, 12:45 AM
I have a viewport with north and center panels.
I'm using the center with a cardLayout to load components dynamically from the server,
that's why I can't use just a north/west/center border layout.
I've noticed that ext is firing too many resize and afterlayout events.
I've attached an event listener to several components and when resizing the browser window I'm getting:

hbox-child-resize
hbox-child-resize
hbox-layout
hbox-resize
hbox-child-resize
hbox-child-resize
hbox-layout
center-layout
center-resize
center-layout

Please drop this html file in the examples folder to test it:

<html>
<head>
<title>Complex Layout</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />

<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<!-- ENDLIBS -->

<script type="text/javascript" src="../../ext-all.js"></script>

<script type="text/javascript">
Ext.onReady(function(){
var viewport = new Ext.Viewport({
layout:'border',
items:[
{
region: 'north',
height: 50,
border: false,
tbar: new Ext.Toolbar({
id: 'hd-tbar',
defaults: {
scale: 'medium'
},
items: [{
text: 'btn1',
}, {
text: 'btn2'
}, '-', {
text: 'btn3'
}, '-', {
text: 'btn4'
}]
})
}, {
region: 'center',
id: 'center',
layout: 'card',
border: false,
bodyBorder: false,
activeItem: 0,
listeners: {
'resize': function(){
try {
console.info('center-resize');
}
catch(err){}
},
'afterlayout': function(){
try {
console.info('center-layout');
}
catch(err){}
}
},
items: [{
id: 'hbox',
listeners: {
'resize': function(){
try {
console.info('hbox-resize');
}
catch(err){}
},
'afterlayout': function(){
try {
console.info('hbox-layout');
}
catch(err){}
}
},
layout: 'hbox',
layoutConfig:{
align: 'stretch',
pack: 'start'
},
items: [{
title: 'west-hbox',
width: 380
}, {
title: 'center-hbox',
flex: 1,
listeners: {
'resize': function(){
try {
console.info('hbox-child-resize');
}
catch(err){}
}
}
}]
}]
}
]
});
});
</script>
</head>
<body>
</body>
</html>


The try,catch blocks are because I'm having problems with FB 1.4.

Is this a bug or wrong nesting?

Thanks

evant
31 Aug 2009, 12:54 AM
There's been a number of fixes regarding laying out since 3.x came out. I'd say it will probably go a fair way to alleviating the issue.

dolittle
31 Aug 2009, 12:57 AM
There's been a number of fixes regarding laying out since 3.x came out. I'd say it will probably go a fair way to alleviating the issue.

When wil it be available to download?
I bought a license but not SVN access.

dolittle
31 Aug 2009, 1:14 AM
can you at least verify that this problem doesn't occur in the latest Ext build
or maybe I should post it in the bugs section?