PDA

View Full Version : After Store remove() and sync(), second remove() and sync() send row already removed



caiohc
7 Aug 2013, 3:31 AM
Hi folks!

I execute these two methods in a Store:
store.remove(event);
store.sync();
Everything works fine, and the grid doesn't show the deleted row anymore.
I can see the row sended for deletion via chrome console:

{endDate: null, id: 3, name: "Event 1", notes: "", screenAlert: true, ...}

But when I select another row and ask for the Store to remove and sync again, it sends two rows to remove to the server, the first one is the row that was removed previously. I was able to see in chrome console:

[{endDate: null, id: 3, name: "Event 1", notes: "", screenAlert: true, ...},
{endDate: null, id: 4, name: "Event 2", notes: "", screenAlert: true, ...}]

And if I ask again to remove and sync again, the same row, it works, sendig to the server just one row:

{endDate: null, id: 4, name: "Event 2", notes: "", screenAlert: true, ...}

And the cicle keeps repeating.
Why is this happening?

Why is this happening? :s

Gary Schlosberg
9 Aug 2013, 9:57 AM
Would it be possible for you to post some code that reproduces the issue?

Renan Cunha
10 Aug 2013, 2:06 PM
Are you sure that sync is returning success?
Try to put a listener in the sync call to the success and failure callback functions and see what's happening.



store.sync({
success: function () { console.log('successfully'); },
failure: function () { console.log('something going wrong... =P'); }
});