PDA

View Full Version : Store does not get new ID after create



Jan Sepke
13 Feb 2014, 6:59 AM
I have a editable grid with store + model + REST-Proxy.
Get, update and delete is no problem, but if I do:


store.insert(0,{});
cellEditing.startEditByPosition({ row: 0, column: 1 });

the server respond with:

{
"success":true,
"results":1,
"root":"data",
"message":null,
"data":{"TerritoryUserPK":"7f064ddd-d5c9-47ae-94cc-29da14d27962"},
"debug":null
}
where "TerritoryUserPK" is the idProperty of the model.
I would now expect that the store will use this id for the new object, but it remains "ext-record-1".
How must the server response look like, so the Ext Store excepts the new ID?
The reader is this:


reader: {
type: 'json',
root: 'data',
messageProperty: 'message',
totalProperty: 'results'
}

mitchellsimoens
20 Feb 2014, 8:02 AM
It's working for me:

3pm

Jan Sepke
3 Mar 2014, 10:53 AM
I found my mistake, the root property was overidden by the first GET requests to get the full list. But the response of a POST has no metadata and another root field.

I totally forgot about the metadata. Will see that we use metadata everywhere or only one root property...