Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I top align two areas in an ExtJS table layout?

The ExtJS code below creates two regions to the left and right of each other, like this:

enter image description here

What do I have to change to this code so that the two areas are top aligned?

<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>
like image 687
Edward Tanguay Avatar asked Mar 07 '11 13:03

Edward Tanguay


1 Answers

In ExtJS 4, you can use the tdAttrs config option:

layout: {
    type: 'table',
    columns: 2,
    tdAttrs: {
        valign: 'top'
    }
}
like image 123
nogridbag Avatar answered Nov 15 '22 18:11

nogridbag