[英]CRUD bulk update/insert through an ajax proxy
I was working on bulk update/insert through an ajax proxy. 我正在通过ajax代理进行批量更新/插入。 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? 我使用store.sync()
它将为每条脏记录击中服务器,但是如果我在服务器中的任何一条记录中遇到错误,如何用适当的消息通知客户端?
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 }
There are three methods available when a store
is updated via sync
. 通过sync
更新store
时,可以使用三种方法。 onUpdateRecords
, onDestroyRecords
, and onCreateRecords
. onUpdateRecords
, onDestroyRecords
和onCreateRecords
。 You can view the success
property coming back and rejectChanges
您可以查看success
属性返回并rejectChanges
For Example : onUpdateRecords: function(records, operation, success) { if (!success){ this.rejectChanges(); } }
例如 : onUpdateRecords: function(records, operation, success) { if (!success){ this.rejectChanges(); } }
onUpdateRecords: function(records, operation, success) { if (!success){ this.rejectChanges(); } }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.