PDA

View Full Version : How to return server response on sync batchmode multiple records operations



maneljn
9 Nov 2012, 1:33 AM
Can anyone explain (with example if possible) what response structure i have to return from php to client side if i want to receive all refreshed data to propagate new ids records, and to obtain each error message from each record that i have sended with sync ?

vietits
9 Nov 2012, 5:32 AM
1. For creating/updating requests, you should return something like this:


{
"success": true/false,
"data": [...] // an array of updated or newly created records with ids
}

2. For deleting requests, you should return {"success": true} or {"success": false}

maneljn
9 Nov 2012, 6:23 AM
thanks vietits, and for return one error message or correct message for each record ?

vietits
9 Nov 2012, 3:39 PM
What I mentioned is for returning response for each request. It tells that request is successful or not but it does not tell which record is successful and which record is error. Maybe you should include this information in each returned record and handle it by yourself.

maneljn
10 Nov 2012, 9:23 AM
tome someone who could interest.
See also this link to an approach of commit records with succes: false return value in sync() method

http://www.sencha.com/forum/showthread.php?248584-How-can-i-force-store-commitRecords-after-sync-in-batch-mode-if-just-one-record-fails