我用这个调用保存:
console.log(this.model.isNew());
console.log(this.model);
this.model.save({}, {
success: function (model, response, options) {
console.log(response);
},
error: function (model, xhr, options) {
console.log(xhr.result.Errors);
}
});
isNew()
返回错误。但输出this.model
的 ID 为 0。(this.model.id 也是 0)
我的网址是url: ROOTAREA + "/Expenses/Entry/",
更新工作正常,并按预期使用 PUT。
编辑:这是我模型的一部分:
defaults: function () {
return {
DocumentDate: "",
JobNo_: "",
PhaseCode: "",
WorkTypeCode: "",
Description: "",
Quantity: 0,
UnitCost: 0,
ExpenseCurrencyCode: "",
ReimbursementCurrencyCode: "",
UnitofMeasureCode: "DIEM",
LineNo_: 0
};
},
idAttribute: "LineNo_",