의 PUT 보내는 :백본 model.save는() 대신 POST
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()
false를 반환합니다. 그러나 this.model
의 출력은 0의 ID를 (this.model.id뿐만 아니라 0)
내 URL이 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_",
나는 모델을 보여주는 내 게시물에 편집을했습니다. LineNo_를 0이 아닌 다른 것으로 변경해야합니까? – Rail24
@ Rail24 가능한 경우 완전히 제거하십시오. 백본은 ID가 null인지 여부를 확인하기 위해 null을 확인합니다. http://documentcloud.github.com/backbone/docs/backbone.html#section-63 – nikoshr
을 참조하십시오. LineNo_가 null로 기본값으로 변경되었으며 문제가 해결되었습니다. 감사합니다 toninoj! – Rail24