我需要Ember Data来批量更新我的一个模型。所以我设置了
bulkCommit: true
DS.RESTAdapter
中的。但现在它甚至使用批量提交来更新单个记录!
这是非常意外的行为。
那么当超过1项提交时,如何修改Ember数据以仅使用批量提交?
答案 0 :(得分:0)
以下是我现在所做的事情:
updateRecords: function(store, type, records) {
var arr;
arr = records.list;
if (arr.length === 1) {
return this.updateRecord(store, type, arr[0]);
} else {
return this._super(store, type, records);
}
}
检查records
是否包含单个项目,然后调用updateRecord
。
createRecords
和deleteRecords
会相应更改。