1
我在使用卡布局內的不同面板高度時遇到問題。大多數內容適合我爲容器面板指定的高度,但有一個是其餘的兩倍,我不知道如何讓該面板自然擴展。我意識到大小可以動態設置,但我認爲有一個更簡單的方法,因爲面板最終成爲div中的div。下面是需要被調整爲面板的代碼和它的容器:如何更改父容器的面板高度以匹配子內容?
var platform = viewport.platform = new Ext.Panel ({
cls: 'page',
height: 600,
items: [
{
html: "<h1>Platform Dev</h1><h2>Application Deployment I: iPhone and iPad</h2><p>The Application Deployment I: iPhone and iPad Course requires students to create and deploy an application to an iOS device by building upon concepts introduced in the Mobile Frameworks and Objective C courses. Upon successful completion of the OS Application course, students will produce an interactive application that can be deployed on Apple¹s iOS devices.</p><h2>Application Deployment II: Android</h2><p>The Application Deployment II: Android Course requires students to create and deploy an application to an Android powered device. Students build upon concepts introduced in the previous programming courses and work through the processes involved by researching and implementing project management techniques."
},
{
xtype : 'carousel',
ui : 'light',
direction: 'horizontal',
height: 150,
items: [
{
html: 'infographic 1',
cls : 'infographic1'
},
{
html: 'Card #2',
cls : 'infographic2'
},
{
html: 'Card #3',
cls : 'infographic3'
},
{
html: 'Card #3',
cls : 'infographic4'
}
]
}
],
layout: {
type: "vbox",
align: "stretch"
},
// scroll: 'vertical'
});
mainContent = viewport.mainContent = new Ext.Panel ({
id: "main_content",
layout: "card",
height: 220,
items: [introText, mobileDev, games, utilities, platform, newContact],
cls: "content",
cardSwitchAnimation : "slide",
});
那是一個特定面板目前我正在使用的解決方案,但客戶需要的是'mainPanel',它目前被設置爲220的高度,以擴展到內容的大小最終會變大。包含所有內容的面板會滾動,因此如果mainPanel要變長,我仍然可以向下滾動。 –