Hi all!
I'm having some troubles loading form data (populating fields) into fields which are located in a nested container in the form.
I went from this example (form 5).
Code is as follows:
PHP Code:
MyForm = Ext.extend(Ext.form.FormPanel, {
initComponent: function () {
var config;
config = {
url: 'save.php',
reader: new Ext.data.JsonReader({
idProperty: 'id',
fields: ['id', 'introduction', 'title', 'content']
}),
items: [{
xtype: 'textarea',
name: 'introduction'
}, {
xtype: 'tabpanel',
plain: true,
activeTab: 0,
deferredRender: false,
defaults: {layout: 'form'},
items: [{
title: 'Foo',
items: [{
xtype: 'textfield',
name: 'title'
}, {
xtype: 'textarea',
name: 'content'
}]
} /* more tabs */]
}]
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
MyForm.superclass.initComponent.apply(this, arguments);
this.load({
url: 'data.php'
});
}
});
Example response:
Code:
{"id":1,"introduction":"Intro","title":"Foo","content":"Lipsum..."}
While i was digging i discovered that 'Ext.form.BasicForm.findField' only looks in it's own 'items' collection and doens't cascade/recurse into underlying containers. Therefore it only finds the 'introduction' field and populated that, but not the 'title' and 'content' fields.
Does anyone have an idea how to solve/work around this?
Thank in advance,
Zogs