简体   繁体   English

ExtJs设置窗口高度

[英]ExtJs set window height

I am tring to dynamicaly set window height: 我正在尝试动态设置窗口高度:

 component.remove(Ext.getCmp("comboBoxTypeOfSchool", true));
 component.remove(Ext.getCmp("comboBoxProgram", true));
 Ext.getCmp("winDecisionEditor").setHeight(190);

But, in browser i see that it sets height to "winDecisionEditor-body", not to "winDecisionEditor". 但是,在浏览器中,我看到它将高度设置为“ winDecisionEditor-body”,而不是“ winDecisionEditor”。 How can I set height to "winDecisionEditor"?. 如何将高度设置为“ winDecisionEditor”? Thanks in advance! 提前致谢!

Here my decaration of window: 这是我对窗户的看法:

Ext.define('MyApp.view.decisionWindow', {
extend: 'Ext.window.Window',

requires: [
    'Ext.form.Panel',
    'Ext.form.field.Date',
    'Ext.form.field.ComboBox',
    'Ext.form.field.Display',
    'Ext.button.Button',
    'Ext.form.FieldSet'
],

height: '',
id: 'winDecisionEditor',
margin: '',
width: 707,
layout: 'fit',
title: 'Create decision',
modal: true,

//Other stuff
});

UPDATE: fiddle for the issue 更新:摆弄这个问题

https://fiddle.sencha.com/#fiddle/12rh https://fiddle.sencha.com/#fiddle/12rh

I think that the problem is the layout. 我认为问题在于布局。 Layout fit is not the best choice for your page, because it fit the inner panel to the container (and not viceversa). 布局适合不是您页面的最佳选择,因为它使内部面板适合容器(反之亦然)。

I think that if you would like to stretch the window to the inner items (and so change the size of the "items area" to the desired, that is in your example 190) you should use another layout. 我认为,如果您想将窗口拉伸到内部项目(并因此将“项目区域”的大小更改为所需的大小,即您的示例190),则应该使用其他布局。 for instance in may example I'm using layout:{type:'vbox', align:'stretch'} . 例如在may example中,我正在使用layout:{type:'vbox', align:'stretch'}

Here i modify the original fiddle: 在这里,我修改原始的小提琴:

https://fiddle.sencha.com/#fiddle/12ri https://fiddle.sencha.com/#fiddle/12ri

UPDATE: 更新:

Please consider the very important answer of Mitchell Simoens , that is 请考虑Mitchell Simoens的非常重要的答案,即

Fit layout but didn't explain it properly. 布局合适,但未正确解释。 Fit layout takes the first child component (only ONE) and fits it to the size of the container (window in this case). Fit布局采用第一个子组件(仅ONE)并将其适合容器的大小(在这种情况下为窗口)。

That means, the first combobox will have the size of the window and will not show the other items at all. 这意味着,第一个组合框将具有窗口的大小,并且根本不会显示其他项。 Fit layout will size the container to it's child component. 适合的布局将根据容器的子组件调整大小。

https://fiddle.sencha.com/#fiddle/12rs https://fiddle.sencha.com/#fiddle/12rs

Notice where the sizes are (or lack of sizes and autosizing happens) 注意大小在哪里(或缺少大小和自动调整大小)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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