我有一个表单,其中一个字段为可编辑网格。
store.sync()
应该在Events.AfterEdit()
之后使用或者只保存在表单上吗?码:
store.sync({
callback: function () {
console.log('callback', arguments);
},
success: function () {
console.log('success', arguments);
},
failure: function (batch, opt) {
//code for failure
}
});
实际上我们不需要store.sync()来保存可编辑网格的数据。如果我们通过使用model.save()或类似的操作来获得正确的json数据,我们可以通过模型的正常操作来完成它。以下是设置数据的摘录。
var rowIndex = myGrid.find('id', yourServerResponseData.id);
var rowRecord = myGridStore.getAt(rowIndex);
rowRecord.set(yourServerResponseData);
rowRecord.commit();