View Full Version : [INFOREQ]Store returning all records for getNewRecords

18 May 2011, 10:25 AM
I have a problem with a Model/Store. The store is set to autoload the records via a proxy. However once the records are loaded and store.getNewRecords() is called, all the records in the store are returned as new. This doesn't seem right. Also and records I update do not get returned when I call store.getUpdatedRecords().


Ext.define('Daedalus.model.Group', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Id', type: 'int', mapping: 'Id' },
{ name: 'Name', type: 'string', mapping: 'Name' }


Ext.define('Daedalus.store.Groups', {
extend: 'Ext.data.Store',
model: 'Daedalus.model.Group',

autoLoad: false,

proxy: {
type: 'rest',
url: Daedalus.app.WcfUrl + '/groups',
reader: 'json'

Update record code

groupSave: function(button, event){
var blind = this.getBlind(button), view = this.getApplication(button), groupStore = Ext.data.StoreManager.lookup('Groups'), form = blind.items.items[0].getForm();

if(blind.mode == "create"){
var record = new Daedalus.model.Group();


Now when I try to sync the changes these arrays do not return what I expect.

//contains all the records. New and updated
var newRecords = groupStore.getNewRecords();

//doesn't contain any records
var updatedRecords = groupStore.getUpdatedRecords();

//all the records are sent to the server which is incorrect

No clue what I'm doing wrong so any help is appreciated.

18 May 2011, 3:56 PM
This looks like a bug. Do you want me to move this thread to Bugs forum?

19 May 2011, 10:32 AM
Yes please and thank you.

19 May 2011, 10:29 PM
What does your data look like? A record is considered "new" if it's a phantom. That is, it doesn't have an id assigned to it from the server.

20 May 2011, 6:54 AM
Here's the JSON output from the server.


This data is loaded via the store proxy.

20 May 2011, 8:17 AM
Managed to find out what the issue was. The default idProperty is "id" not "Id". All that had to be done was to set the idProperty of the JSON reader and everything works as expected. Now this is just my personal opinion, but wouldn't setting the field on a model as a "PrimaryKey" make more sense than on the reader itself?