extjs4.2 控制form表单中field等组件的宽度。

首先,确保form的layout是‘anchor’的。

然后,在代码中配置anchor属性,如下图:

initComponent: function () {
        this.items = [{
            xtype: 'textfield',
            padding: '10 0 0 5',
            anchor: '30%',
            fieldLabel: '申请书编号',
            name: 'appNum'
        },{
            xtype: 'textareafield',
            padding: '10 0 0 0',
            anchor: '100%',
            grow: true,
            name: 'legCharger',
            height: 150
        }];
        this.callParent();
    }

效果如下图:

wKiom1Of3-zAYuyJAACDLGnbQgI566.jpg