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();
}
效果如下圖: