PDA

View Full Version : AutoHeight problem in BorderLayout->ContentPanel->Grid



mangesh
26 Jan 2007, 1:13 AM
Hi,

I am having a following setup
1) BorderLayout
2) BorderLaout contains ContentPanela
3) ContentPanel contains grid. Grid has autoheight=true.

Problem:
The grid doesn't seem to be adjusting it's height to the height of the ContentPanel and hence I do not see any scrollbar for the grid. If I turn on autoscroll=true on the "center" region, the scrollbar apears but it is the scrollbar for the ContentPanel and so if I scroll down, the column headers of the grid scroll with entire content as opposed to being fixed (and always visible). I am sure there is some provision in this GREAT library (thanks Jack) to get away with this problem but I am unable to find it. I am using "autoheight:true" option while creatiing grid




init : function(){
// create the main layout
layout = new YAHOO.ext.BorderLayout(document.body, {
north: {
titlebar: false,
autoScroll:true
},
center: {
titlebar: false,
autoScroll:false
},
south: {
split: true,
titlebar: false,
tabPosition: 'top',
closeOnTab: true,
alwaysShowTabs: true,
collapsible: true,
resizeTabs: true
}
});

// tell the layout not to perform layouts until we're done adding everything
layout.beginUpdate();
layout.add('north', new YAHOO.ext.ContentPanel('filterColumns', {autoCreate : true,fitToFrame:true}));
layout.add('center', new YAHOO.ext.ContentPanel('tt-grid', {autoCreate : true,fitToFrame:true}));

// load the grid
this.init2();

detailsTab = new YAHOO.ext.ContentPanel('tab1', {title: "Details", fitToFrame:true});
layout.add('south', detailsTab);
originTab = new YAHOO.ext.ContentPanel('tab2', {title: "Origin", fitToFrame:true});
layout.add('south', originTab);
destTab = new YAHOO.ext.ContentPanel('tab3', {title: "Destination", fitToFrame:true});
layout.add('south', destTab);

layout.getRegion('south').showPanel('tab1');

// restore any state information
layout.restoreState();
layout.endUpdate();
},
[/code]

mdissel
26 Jan 2007, 2:19 AM
Use a GridPanel instead of ContentPanel when you want to grid to be maximized inside a panel.

(search for GridPanel in the forum to see some samples)

Thanks

Marco

mangesh
26 Jan 2007, 2:50 AM
Marco,

Thanks a lot. It works like a charm.

--Mangesh