I was having a similar issue with the following error being thrown when the response does not include the defined root:
Uncaught TypeError: Cannot read property 'length' of undefined
I'm using the following override to get around the error, of course YMMV
Code:
Ext.override(Ext.data.Reader, {
readRecords: function(data){
this.rawData = data;
data = this.getData(data);
var root = this.getRoot(data);
//BEGIN OVERRIDE - insert empty root if one does not exist
if (root == undefined) {
var rootName = this.root;
data[rootName.toString()] = new Array();
root = this.getRoot(data);
}
//END OVERRIDE
var total = root.length, success = true, value, records, recordCount;
if (this.totalProperty) {
value = parseInt(this.getTotal(data), 10);
if (!isNaN(value)) {
total = value;
}
}
if (this.successProperty) {
value = this.getSuccess(data);
if (value === false || value === 'false') {
success = false;
}
}
records = this.extractData(root, true);
recordCount = records.length;
return new Ext.data.ResultSet({
total: total || recordCount,
count: recordCount,
records: records,
success: success
});
}
});