Extjs:两个面板在窗口调整大小时相应地调整大小

标签 extjs resize panel scale

我有一个包含两个子面板的面板。父面板使用“边框”布局,而两个子面板分别使用“窗体”和“列”布局。现在如何使这两个子面板在窗口调整大小时相应地调整大小,即确保这两个面板的大小比例恒定。

谢谢!

我的代码如下:

itemRts = {
    xtype: 'panel',
    title: 'Route',
    region: 'north',
    autoHeight: true,
    layout: 'form',
    width: 294,
    bodyStyle: 'padding:10px 12px 10px',
    id: 'ROUTE_PANEL',
    el: 'Route_Setup',
    items: [
    {
        xtype: 'button',
        text: 'Go',
        anchor: '0',
        id: 'GO_BTN'

    }]
};

itemEvts = {
    xtype: 'panel',
    title: 'Events',
    region: 'center',
    layout: 'column',
    tpl: 'Please put events here.',
    //bodyStyle: 'padding:10px 12px 10px',
    border: false,
    hideBorders: true,
    id: 'EVENT_PANEL',
    el: 'Event_Legend',
    autoScroll: true
};

newView = new Ext.Viewport({
    layout: "border",
    items: [

    {
        xtype: 'panel',
        margins: '10 0 10 10',
        region: 'center',
        width: 200,
        layout: 'border',
        split: true,
        boxMaxWidth: 280,
        minWidth: 280,
        id: 'RTS_EVTS_REGION',
        collapseMode: 'mini',
        items: [
        itemRts,
        itemEvts]
    }]
});

如何修改上面的代码以使其按我想要的方式工作?

再次感谢!

最佳答案

您可以为容器面板设置调整大小事件,并在调整大小的情况下调用其子项的“dolayout”方法:

newView = new Ext.Viewport({
    layout: "border",
    items: [

    {
        xtype: 'panel',
        margins: '10 0 10 10',
        region: 'center',
        width: 200,
        layout: 'border',
        split: true,
        boxMaxWidth: 280,
        minWidth: 280,
        id: 'RTS_EVTS_REGION',
        collapseMode: 'mini',
        items: [itemRts, itemEvts],
        listeners: {
            'resize': function () {
                itemRts.doLayout();
                itemEvts.doLayout();
            }
        }
    }]
});

关于Extjs:两个面板在窗口调整大小时相应地调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5926602/

相关文章:

javascript - 禁用 ExtJs 应用程序的缓存

javascript - 如果在此期间没有记录发生更改,则两秒后同步存储

带有附加选项的 Extjs4 组合框

html - 手动允许用户在系统内调整 <td> 的大小

css - 在 CSS 中调整背景图像的大小

extjs - 在 TreePanel 上拖放后如何触发事件

javascript - 在 Ext JS Ajax 请求中发送 'Authorization' header ,Chrome 与 Firefox

Javascript 改变窗口大小

jquery - 面板无法在使用 JQuery Mobile 的所有页面中工作

c# - 如何在 Panel 上绘制以使其不闪烁?