您可以将所有面板包裹在一个表单面板中,并提交所有内部字段。我采用这种方式,将accordeons,tabpanel和普通面板深深嵌套在一起。例如:
var form = Ext.create('Ext.form.Panel', {
// form attributes goes here...
// ...
initComponent: function(){
// all your panels goes here.
this.items = [
{
xtype:'panel',
title: 'First panel',
layout: 'anchor',
frame: true,
defaults: {anchor: '100%'},
items: [
{xtype:'textfield', name: 'foo',fieldLabel: 'Foo'},
{xtype:'textfield', name: 'foo',fieldLabel: 'Bar'}
]
},
{
xtype:'panel',
title: 'Second panel',
layout: 'anchor',
frame: true,
defaults: {anchor: '100%'},
items: [
{xtype:'textfield', name: 'baz',fieldLabel: 'Baz'},
{
xtype: 'panel',
items: [/* another set of fields */]
}
]
},
];
this.buttons = [/* ... your buttons here ...*/];
this.callParent(arguments);
}
});
感谢您的回答。我做错的是,我创建了这些面板作为隐藏字段的后代(其中包含面板中字段的数据),这就是表单不能识别它们的原因。解决方案是让隐藏字段将第一个面板(其中包含带有字段的嵌套面板)添加到窗体面板,而不是使其成为隐藏字段的成员。 – 2011-06-18 12:25:46