ExtJs 设置 window 高度
ExtJs set window height
我正在尝试动态设置 window 高度:
component.remove(Ext.getCmp("comboBoxTypeOfSchool", true));
component.remove(Ext.getCmp("comboBoxProgram", true));
Ext.getCmp("winDecisionEditor").setHeight(190);
但是,在浏览器中我看到它将高度设置为 "winDecisionEditor-body",而不是 "winDecisionEditor"。如何将高度设置为 "winDecisionEditor"?。提前致谢!
这是我对 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
});
更新:fiddle 问题
我认为是布局问题。布局适合不是您页面的最佳选择,因为它使内部面板适合容器(反之亦然)。
我认为,如果您想将 window 拉伸到内部项目(因此将 "items area" 的大小更改为所需的大小,在您的示例中为 190),您应该使用另一种布局。例如在可能的例子中我正在使用 layout:{type:'vbox', align:'stretch'}
.
这里我修改原fiddle:
https://fiddle.sencha.com/#fiddle/12ri
更新:
请考虑非常重要的答案
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).
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
Notice where the sizes are (or lack of sizes and autosizing happens)
我正在尝试动态设置 window 高度:
component.remove(Ext.getCmp("comboBoxTypeOfSchool", true));
component.remove(Ext.getCmp("comboBoxProgram", true));
Ext.getCmp("winDecisionEditor").setHeight(190);
但是,在浏览器中我看到它将高度设置为 "winDecisionEditor-body",而不是 "winDecisionEditor"。如何将高度设置为 "winDecisionEditor"?。提前致谢!
这是我对 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
});
更新:fiddle 问题
我认为是布局问题。布局适合不是您页面的最佳选择,因为它使内部面板适合容器(反之亦然)。
我认为,如果您想将 window 拉伸到内部项目(因此将 "items area" 的大小更改为所需的大小,在您的示例中为 190),您应该使用另一种布局。例如在可能的例子中我正在使用 layout:{type:'vbox', align:'stretch'}
.
这里我修改原fiddle:
https://fiddle.sencha.com/#fiddle/12ri
更新:
请考虑非常重要的答案 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).
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
Notice where the sizes are (or lack of sizes and autosizing happens)