mercredi 28 mai 2014

id param when a object is created

I'm using Parse.com's REST API, and I'm running into an issue with newly created objects.

Using Sencha Touch, when I do:



Code:



var group = Ext.create('X.model.Group', newGroup);
group.save()

Sencha Touch automatically creates an id for the new instance of Group which gets sent to the server as POST on save()

Unfortunately Parse doesn't like that and it fails to create a new record in the database.


I've tested creating a new object without the id field (outside of Sencha Touch) and it worked.


So, is there any way to make sure that objectId is not sent on create.


One thing I tried was having persist: false on id. Doing this does create the group, but then the local group instance's id isn't getting updated with the new id sent by Parse on create.


Note that when I say id above, I really mean 'objectId', as I have idProperty: 'objectId' set on my models.


Any ideas how to make this work? Any help is much appreciated! Thanks!





Aucun commentaire:

Enregistrer un commentaire