PDA

View Full Version : [OPEN] [FIXED-235][3.0.1] XmlReader record lost node property



Condor
6 Sep 2009, 11:10 PM
In Ext 1.x, 2.x and 3.0.0 the XmlReader added a node property to each record containing the XML node that was used to extract the data.

In Ext 3.0.1 and up this feature was removed. To keep backward compatibility I recommend adding:

Ext.override(Ext.data.XmlReader, {
extractData : function(root, returnRecords) {
var Record = this.recordType,
records = [],
f = Record.prototype.fields,
fi = f.items,
fl = f.length;
if (returnRecords === true) {
for (var i = 0, len = root.length; i < len; i++) {
var data = root[i];
var record = new Record(this.extractValues(data, fi, fl), this.getId(data));
record.node = data;
records.push(record);
}
} else {
for (var i = 0, len = root.length; i < len; i++) {
var data = this.extractValues(root[i], fi, fl);
data[this.meta.idProperty] = this.getId(data);
records.push(data);
}
}
return records;
}
});

Animal
6 Sep 2009, 11:34 PM
Good idea, maybe JsonReader should also insert into the Record a reference to the row object from which the data was extracted. ArrayReader too. Then all renderers would be able to see all the raw data.

Condor
6 Sep 2009, 11:36 PM
Ext already does that! Both JsonReader and ArrayReader store the raw object as 'json' property in the record.

(and this has been the case since Ext 1.0 I might add)

Animal
7 Sep 2009, 1:54 AM
Yes, I see now I look at the code. I'll wait until the node property is reimplemented and add some helpful documentation about this useful feature.

evant
10 Sep 2009, 3:01 AM
Fix applied to svn in rev #5317 for patch release 3.0.2.