希望能帮助到你。
使用anchor属性的可以设置window中的组件自适应窗口大小,它通过指定百分比或者偏移量来控制自组建的大小。anchor一般作为layout:'anchor'的容器配置子组建的选项。下面代码中form类型默认即为layout:'anchor'。
例如:
var form = Ext.create('Ext.form.Panel', { .....
items: [
{fieldLabel: 'Send To', name: 'to', anchor:'100%' // anchor width by percentage },
{ fieldLabel: 'Subject',name: 'subject',anchor: '100%' // anchor width by percentage }....
}
var win = Ext.create('Ext.window.Window', { ....items: form,
完整例子代码,可以参考:
http://dev.sencha.com/deploy/ext-4.0.0/examples/form/anchoring.html
anchor属性完整描述可以参考:
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.layout.container.Anchor