1

extjs4にhboxレイアウト内の1つの要素だけを伸ばすように指示する方法は?

たとえば、次のレイアウトがあります。

{
    flex: 1,
    layout: {
        type: 'vbox',
        align: 'stretch'
    },
    items: [{
        flex: 1,
        // GRID, needs to be stretched
    }, {
        // button, don't stretch
    }, {
        // another button, don't stretch
    }]
}

上記のコードでは、すべての要素 (ボタンを含む) が引き伸ばされています。ボックスレイアウトで可能ですか?

もちろん、ボタンを hbox コンテナーにラップすることもできますが、この解決策は好きではありません。

4

1 に答える 1

1

使用できる回避策の 1 つはmaxHeight、制約が常に「勝つ」ため、ボタンに を指定することです。

Ext.onReady(function(){
    Ext.create('Ext.panel.Panel', {
        width: 400,
        height: 300,
        renderTo: document.body,
        layout: {
            type: 'hbox',
            align: 'stretch'
        },
        items: [{
            flex: 1,
            title: 'A panel'
        }, {
            xtype: 'button',
            text: 'B1',
            maxHeight: 25
        }, {
            xtype: 'button',
            text: 'B2',
            maxHeight: 25
        }]
    })
});
于 2013-04-17T11:44:13.787 に答える