javascript - 如何顶部对齐 ExtJS 表格布局中的两个区域?

标签 javascript extjs

下面的 ExtJS 代码在彼此的左侧和右侧创建了两个区域,如下所示:

enter image description here

我必须对此代码进行哪些更改才能使这两个区域顶部对齐?

<script type="text/javascript">

    var template_topbottom_top = new Ext.Panel({
        frame: false,
        border: false,
        header: false,
        items: []
    });

    var template_topbottom_bottom = new Ext.Panel({
        frame: false,
        border: false,
        header: false,
        items: []
    });    

    var template_topbottom = new Ext.Panel({
        id:'template_topbottom',
        baseCls:'x-plain',
        renderTo: Ext.getBody(),
        layout:'table',
        layoutConfig: {columns:2},
        defaults: {
            frame:true,
            style: 'margin: 10px 0 0 10px; vertical-align: top' //doesn't work
        },
        items:[{
                width: 210,
                height: 300,
                frame: false,
                border: true,
                header: false,
                items: [template_topbottom_top]
            },{
                width: 1210,
                height: 200,
                frame: false,
                border: true,
                header: false,
                items: [template_topbottom_bottom]
            }
        ]
    });

    replaceComponentContent(targetRegion, template_topbottom, true);

</script>

最佳答案

在 ExtJS 4 中,您可以使用 tdAttrs 配置选项:

layout: {
    type: 'table',
    columns: 2,
    tdAttrs: {
        valign: 'top'
    }
}

关于javascript - 如何顶部对齐 ExtJS 表格布局中的两个区域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5220253/

相关文章:

css - 里面有元素的最后一个 child

javascript - TypeScript 不提供函数名称

Javascript,仅在用户使用 IE10 时运行

javascript - 使用 css 格式化 div

extjs - 在 ExtJS 中单击元素添加类

javascript - 在没有面板的情况下渲染 ExtJs 组件?

javascript - 世博会相机拍照崩溃应用程序

javascript - 如何设置 Angular 2 Material Design 2.0.0-beta.2

javascript - Angular 13 : Module not found: Error: Can't resolve 'rxjs/operators'

javascript - Extjs - formPanel 上的 isValid()