Opened 9 years ago

Closed 6 years ago

#11766 closed defect (wontfix)

JsonRestStore.getIdentity(): order of precedence is wrong?

Reported by: Simon Speich Owned by: Kris Zyp
Priority: high Milestone: tbd
Component: DojoX Data Version: 1.5
Keywords: JsonRestStore, getIdentity, newItem Cc:
Blocked By: Blocking:

Description

When using store.newItem() either the client-side or the server-side generated id is used depending on the the server's response. If the server responds with a Location header in the POST, the Location is used as the id. But store.getIdentity() favors item.clientId over item.id, so the id in the Location header is never used, e.g.:

// currently (wrong?):
getIdentity: function(item){
	var id = item.__clientId || item.__id;
	if(!id){
		return id;
	}
	...
},

Patch (order in first line changed):

getIdentity: function(item){
	var id = item.__id || item.__clientId;
	if(!id){
		return id;
	}
	...
},

Change History (3)

comment:1 Changed 9 years ago by Jared Jurkiewicz

Owner: changed from Jared Jurkiewicz to Kris Zyp

I believe the order is correct. The identity, clientside, should never change as widgets like Grid cache and index by them. Reassigning to Kris to confirm.

comment:2 Changed 7 years ago by adros

Please could anyone give more explanation to this issue? Is it not possible to get the newly assigned ID of the item by standard API?

comment:3 Changed 6 years ago by Colin Snover

Resolution: wontfix
Status: newclosed

dojox/data is abandoned. Some dojox/data stores have been upgraded to use the Dojo Store API and can be found at https://github.com/kfranqueiro/dojo-smore.

Note: See TracTickets for help on using tickets.