繁体   English   中英

如何根据其内容调整ExtJS窗口宽度?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM