PDA

View Full Version : Logic in Memory Proxy in case of no records



ojintoad
14 Feb 2014, 2:08 PM
In the MemoryProxy read method:

http://docs.sencha.com/extjs/4.2.2/source/Memory.html#Ext-data-proxy-Memory-method-read

We have the following code block:



// Reader reads the whole passed data object.
// If successful and we were given a start and limit, slice the result.
if (me.enablePaging && operation.start !== undefined && operation.limit !== undefined) {

// Attempt to read past end of memory dataset - convert to failure
if (operation.start >= resultSet.total) {
resultSet.success = false;
resultSet.count = 0;
resultSet.records = [];
}
// Range is valid, slice it up.
else {
resultSet.records = Ext.Array.slice(resultSet.records, operation.start, operation.start + operation.limit);
resultSet.count = resultSet.records.length;
}
}


I've bolded the line that compares the operation start to the resultSet total above. The comapirson is done such that if the operation start is greater than OR equal to the resultSet total, then the resultSet considers it a failure.

However, is this technically accurate? If the resultSet has 0 records and the start is at an offset of 0, then shouldn't it still be considered a success?

Let me know if I can provide more information.

skirtle
15 Feb 2014, 10:24 AM
From a quick look I'm inclined to agree with you, it does look like this could be considered a bug.

ojintoad
19 Feb 2014, 8:32 PM
Okay. I will probably write this up as a bug report then. Thanks.