为什么记录会成功保留,其余代理会调用POST / Create操作,然后在后续保存中调用相同的POST / Create方法而不是PUT / Update方法?
帖子
var ref = beginQuestionnaireControl.getPegfileRef();
var Pegfile = Ext.create('Pegfect.model.Pegfile', {
Id: 0,
Reference: ref
});
Pegfile.save({
scope: this,
success: function (pegfile, operation) {
this.activePegfile = pegfile;
this.startQuestions();
},
failure: function () {
alert('That ref is not unique');
}
});
也是POSTS(期待PUT)
this.activePegfile.save({
success: function () {
successCallback();
},
failure: function () {
alert('oops, error saving Pegfile');
}
});
代理
proxy:
{
type: 'rest',
url: 'Pegfile',
timeout: 120000,
noCache: false,
reader:
{
type: 'json',
root: 'data',
successProperty: 'success'
},
writer:
{
type: 'json',
writeAllFields: true
}
}
答案 0 :(得分:0)
诀窍是在模型上定义'Id
'属性:
idProperty: 'Id'
对这个问题的配置大肆宣传...