![](/img/trans.png)
[英]How to adjust height of nested div according to its content in accordion slider?
[英]How to adjust ExtJS window width according to its content?
我正在使用ExtJs。
有什么方法可以根據其項目調整Ext.Window
的寬度嗎?
高度自動調整為“自動”,但width:'auto'
將其擴展到整個瀏覽器窗口。
var childPnl1 = { // 1
frame: true,
width: 350,
height: 50,
html: 'My First Child Panel',
title: 'First children are fun'
}
var childPnl2 = { // 2
width: 150,
html: 'Second child',
title: 'Second children have all the fun!'
}
new Ext.Window({
renderTo: Ext.getBody(),
items: [
childPnl1,
childPnl2,
{
title: '3rd',
width: 400, //Maximum
height: '150',
frame: true
}
]
});
現在,我需要一種方法來使窗口將其寬度調整為400。
一種方法是迭代所有panels
,然后獲得最合適的邊緣,但是我想避免這種情況。
當然它將擴展到整個瀏覽器窗口,為什么不對項目寬度和窗口寬度使用公共變量呢? 另外,它可以保證窗口大小不大於項目寬度。 有時在不同情況下,autoWidth的行為也有所不同。 因此,最好使用手動寬度。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.