PDA

View Full Version : [OPEN-1062] Load Record by itemId doesn't work for composite fields



zefciu
18 Jun 2010, 2:55 AM
The loadRecord function can find fields by itemId as well as by id and name. However it's only true for fields that can be found by "BasicForm.get()", so it doesn't work for parts of CompositeField.

The fix I used is simply changing the findField function like this:

findField : function(id) {
var field = this.items.get(id);

if (!Ext.isObject(field)) {

var findMatchingField = function(f) {
if (f.isFormField) {
if (f.dataIndex == id || f.id == id || f.getName() == id || f.itemId == id) {
field = f;
return false;
} else if (f.isComposite && f.rendered) {
return f.items.each(findMatchingField);
}
}
};

this.items.each(findMatchingField);
}
return field || null;
},I don't know if it's a bug or a feature (the docs don't say explicitly if loadRecord should take itemId into account), so excuse mi if it's intended behaviour and move this thread.

arpeggian
24 Jul 2012, 12:57 PM
Yes, how to call loadRecord with itemId