PDA

View Full Version : reload Iframe when resizing COntentPanel



elpoj
27 Oct 2006, 10:07 AM
Hello,

I've discovered yahoo.ext few days ago and it seems to fullfill my desires (Thx Jack). I have defined my layout as follow :


Example = function(){
return {
init : function(){
var layout = new YAHOO.ext.BorderLayout(document.body, {
north: {
split:false,
initialSize: 73
},
south: {
split:true,
initialSize: 100,
minSize: 100,
maxSize: 200,
titlebar: true,
collapsible: true
},
west: {
split:true,
initialSize: 200,
titlebar: true,
collapsible: true,
minSize: 100,
maxSize: 400
},
center: {
autoScroll: true,
titlebar: true
}
});
layout.beginUpdate();
layout.add('north', new YAHOO.ext.ContentPanel('header', {fitToFrame:true}));
layout.add('south', new YAHOO.ext.ContentPanel('footer', {title: 'Footer : Ticker',fitToFrame:true}));
var to=layout.add('west', new YAHOO.ext.ContentPanel('nav', {title: 'Navigation',fitToFrame:true}));
layout.add('center', new YAHOO.ext.ContentPanel('autoTabs', {title: 'Auto Tabs', closable: true}));
layout.add('center', new YAHOO.ext.ContentPanel('content', {title: 'centre', closable: true}));


layout.endUpdate();


}
}

}();

YAHOO.ext.EventManager.onDocumentReady(Example.init, Example, true);



In the west Panel i've put an iframe width=100%, so it resizes dynamically when moving the splitbar, but i'd like to reload the content of the iframe when this happens. I couldn't find any way to do that.
How could i listen to an event telling me 'resize of west controlpanel to (x pixel width by y pixel height)' , which would allow me to reload the iframe content ?

Thank you to everybody, i've already got many answers reading the forum...(even if this time i haven't found anything)

jack.slocum
27 Oct 2006, 10:32 AM
There are two ways:

Directly on the region:

layout.getRegion('west').on('resized', function(region, newSize){
});

newSize will be a width or height depending on the orientation of the region.

Or on BorderLayout itself for all regions:

layout.on('regionresized', function(region, newSize){
});

elpoj
27 Oct 2006, 10:42 AM
wouaaa so fast....
Thank you jack , i'm tryin'it right now... Is there place where i could have seen the on() function without anoying you ?


Ok Just tested : layout.on('regionresized', function(region, newSize){...} works perfectly.

Thx again