Hi,

I need to add a record to a store and then [mostly] automatically update my pk based on the one generated by the server.

It seems to me that this is what onCreateRecord is for but I haven't seen it documented anywhere so I'm not entirely certain what I'm doing wrong here. I'm not calling it directly as it is called automatically when I save the changes to the store. Here's the code:

Code:
var usersStore = new Ext.data.Store({
	url: 'users',
	reader: new Ext.data.JsonReader({
		root: 'users',
		successProperty: 'success',
		id: 'key',
		fields: [
			{name: 'key'},
			{name: 'nickname'}
		]
	}),
	writer: new Ext.data.JsonWriter({writeAllFields:true}),
	sortInfo:{field:'nickname', direction:'ASC'},
	batchSave: true,
	remoteSort: false
});

var userRecord = Ext.data.Record.create(['key','nickname']);

var nRec = new userRecord({
	nickname: 'test'
});
usersStore.add(nRec);
usersStore.save(nRec);
This part works fine and does send what I need to the server, which in turn does create the new record in the DB and assigns it an ID. Now I then output the following as the response (note: I have no idea what it is expecting so this was my best guess):

Code:
{"data": {"key": "somestring"}, "success": true}
And this is what firebug gives me:

Code:
this.reader.meta.idProperty is undefined
DomHelper()(Object phantom=true id=ext-record-1 data=Object, undefined)ext-all.js (line 1)
DomHelper()(undefined, Object data=Object success=true, true)ext-all.js (line 1)
DomHelper()(Object params=Object request=Object reader=Object, true, Object tId=3 status=200 statusText=OK)ext-all.js (line 1)
b(Object tId=3 status=200 statusText=OK)ext-all.js (line 1)
handleTransactionResponse()ext-base.js (line 104)
handleReadyState()()ext-base.js (line 112)
[Break on this error] Ext.DomHelper=function(){var w=null,l=/^...(Ext.History,new Ext.util.Observable());
Any help will be appreciated thanks