0
votes

I was working on bulk update/insert through an ajax proxy. I use store.sync() this will hit the server for every dirty records but if I get error in any one of the record in server, how to notify the client with proper message?

proxy: {
        type: 'ajax',
        url: "localhost:8888/service/baseLocations",
        reader: {
            type: 'json',
            rootProperty: 'data',
            successProperty: 'success',
            totalProperty : 'total'
        },
        actionMethods: {
            create: 'POST',
            read: 'GET',
            update: 'POST',
            destroy: 'DELETE'
        },
        writer : {
            type: 'json'
        },
        batchActions: false
}
1

1 Answers

1
votes

There are three methods available when a store is updated via sync. onUpdateRecords, onDestroyRecords, and onCreateRecords. You can view the success property coming back and rejectChanges

For Example: onUpdateRecords: function(records, operation, success) { if (!success){ this.rejectChanges(); } }