PDA

View Full Version : CompositeField breaks parent access - findParent doesn't work



nightwatch
12 Aug 2010, 10:36 AM
Hi, I have found a problem with Composite field: If I place some form fields inside a composite field I can't access the parent form from handler functions called for fields inside the composite. Example:


{
"xtype": "form",
"items": [
{
"fieldLabel": "SU Id",
"xtype": "compositefield",
"items": [
{
"allowBlank": false,
"xtype": "combo",
"name": "storageunit",
"anchor": "100%",
"flex": 1.0,
"fieldLabel": "SU Id",
"listeners": {
"change": function(t, nv, ov) {
var f = t.findParentByType('form');
alert('f: ' + f);
alert("ff: " + f.getForm());
}
}
},
{
"text": "Search",
"anchor": "-5",
"xtype": "button"
}
]
},

the problem is here:
f = t.findParentByType('form');
f will be null if the 'storageunit' field is inside a composite. I have no other way of getting a reference to parent form so this is a big obstacle. Without the composite there's no problem with getting parent form reference.
Thanks for outstanding help with my previous problems, hope there's also a solution for this

Best regards
RG