View Full Version : [CLOSED][4.0.0] Store getUpdatedRecords() does not return modified records

28 Apr 2011, 9:48 AM
Using both the cell editor plugin and the row editor, modified records are not returned via getUpdatedRecords(). The method returns an empty array.

To test, I simply used the Ext4 examples for both Cell Editing and Row Editor - then used Firebug to grab the data store and call the method. I can post code if necessary.

Browsers: IE 8 and Firefox

28 Apr 2011, 9:54 AM
This is the expected behaviour. The records are phantoms (no id), so they aren't "updated", they are new records.

28 Apr 2011, 10:25 AM
Hrm... I see what you're getting at. But then how do I grab the modified records? Calling store.getNewRecords() returns all of the records in my data set, not just the rows I've edited.

In 3.x, getModifiedRecords() did exactly what I'm asking for.

28 Apr 2011, 10:28 AM
In 3.x it just returns this.modified, so you can access that collection.

28 Apr 2011, 10:50 AM
The "modified" property you speak of is on each model (or store item).

So if I understand correctly, to get all modified records in the store I would need to do something like:

var modifiedRecords = [];

store.each(function(record) {
var size = 0, key;
for (key in record.modified) {
if (record.modified.hasOwnProperty(key)) size++;
if (size !== 0) { modifiedRecords.push(record); }

That works fine, but I guess I don't understand why this method was removed in 4.x. I suppose in that case it's a feature request because I know many developers use it.

16 May 2012, 6:56 AM
Thank You Arthur Kay
This helped to resolve the issue.