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

标签 javascript extjs window size

我正在使用 ExtJs。

有没有办法根据其项目来调整Ext.Window的宽度?

高度会自动调整为“auto”,但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。

一种方法是迭代所有面板,然后获得最右边的边缘,但我想避免这种情况。

最佳答案

当然它会扩展到整个浏览器窗口,为什么你不使用公共(public)变量呢? 项目宽度窗口宽度?此外,它还能保证您的窗口大小既不大于也不小于项目宽度。有时在不同的情况下,autoWidth 的行为会有所不同。因此最好使用手动宽度。

关于javascript - 如何根据其内容调整ExtJS窗口宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9822341/

相关文章:

ExtJS 解析日期错误

javascript - 在 Sencha Touch 2.1 中按连字符后的第一个字母(如果存在)对列表进行排序和分组

javascript - Vue 与 bootstrap-vue : prevent more than one expanded list-element at all times in list (v-for)

javascript - TinyMCE 自定义主题 - bullist numlist 链接取消链接不起作用

javascript - 无法使用javascript保存数据

javascript - jquery数组按多个元素分组并查找总数

javascript - ExtJs如何在一个 Controller 下创建和管理动态 View

scripting - 我可以使用 Applescript 来控制程序而不将该程序带到前台吗?

java - Selenium 2 : Store webdriver instance id of open window to create new webdriver instance with this id

c# - 我可以获得 Electron 窗口的 MainWindowHandle 吗?