gpt4 book ai didi

extjs - 如何获取 Ext.Panel 的高度以填充父区域

转载 作者:行者123 更新时间:2023-12-02 01:47:33 25 4
gpt4 key购买 nike

我有以下 Ext.TabPanel:

var modules_info_panel = new Ext.TabPanel({
activeTab: 0,
defaults:{autoScroll:true},
//layout: 'fit', // makes component disappear
viewConfig: {
forceFit: true //has no effect
},
// height: auto, //error "auto isn't recognized"
items:[{
title: 'Section 1',
html: 'test'
},{
title: 'Section 2',
html: 'test'
},{
title: 'Section 3',
html: 'test'
}]
});

看起来像这样:

alt text

如何让中间的线向下延伸到底部,以便垂直填充其父空间?

以下是 TabPanel 加载到 regionContent 中的方式:

regionContent = new Ext.Panel({
id: 'contentArea',
region: 'center',
autoScroll: true
});


function clearExtjsComponent(cmp) {
var f;
while(f = cmp.items.first()){
cmp.remove(f, true);
}
}

function replaceComponentContent(cmpParent, cmpContent) {
clearExtjsComponent(cmpParent);
cmpParent.add(cmpContent);
cmpParent.doLayout();
}

replaceComponentContent(regionContent, modules_info_panel);

我看到dom中这个元素的高度是绝对的(19px),在哪里设置的?

alt text

附录

McStretch,我尝试了你的想法,将 layout: 'fit' 放入选项卡本身,但该行仍然位于同一位置:

var modules_info_panel = new Ext.TabPanel({
activeTab: 0,
defaults:{autoScroll:true},
items:[{
title: 'Section 1',
layout: 'fit',
html: 'test'
},{
title: 'Section 2',
layout: 'fit',
html: 'test'
},{
title: 'Section 3',
layout: 'fit',
html: 'test'
}]
});

最佳答案

更正:

抱歉,Edward,我错了,您希望在 regionContent 面板中使用 layout: 'fit'。更新后的代码更改如下。

您最初使用 layout: 'fit' 的想法是正确的,但您将其放置在错误的位置。您需要以下内容:

var regionContent = new Ext.Panel({
region : 'center',
autoScroll : true,
layout : 'fit', // added this line
items : []
});

关于extjs - 如何获取 Ext.Panel 的高度以填充父区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4335916/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com