PDA

View Full Version : Get actual height of a panel after resize of a column



vitolini
17 Nov 2010, 4:59 PM
I have a panel inside a column in the portal, when the column is resized, i want to get the size of the panel, but when i try to reach panel.width and panel.height, they both give me the initial width height not the changed one. I know the width and height variables are available in the resize event, but they are for the portal column really and not exactly define the size of the panel. I have to do extra calculation (remove margins etc...) to get the correct one. Is there a way to correctly get the ACTUAL size of the panel at the moment?



function createEmptyPanel(id, title, width, height)
{
var panel = new Ext.ux.Portlet({
id :'dashboard_'+id,
title: title,
draggable: true,
collapsible: true,
border : true,
anchor: '100% 100%',
height : height,
width : width,
layout: 'anchor',
style:'padding:0px 0px 0px 0px',
plugins : new Ext.ux.MaximizeTool(),
tools : tools
});
return panel;
}

function createDashboardColumn(panel)
{
var column = new Ext.ux.PortalColumn({
columnWidth:.50,
style:'padding:0px 0px 0px 0px',
items:[panel]
});

dashboardPanel.add(column);
dashboardPanel.doLayout();

return column;
}

function createPanelResizer(panel, column)
{
var resizer = new Ext.Resizable(column.getId(), {
pinned:false,
minHeight: 100,
minWidth: 100,
resizeChild: true,
animate: true,
handles: 'all'
});

resizer.on("resize", function(r, width, height, event){
column.syncSize();
if (column.layout)
{
column.doLayout();
}
alert(panel.getSize().width+":"+panel.getSize().height);
});
}