0
我試圖用自定義命令按鈕設置該行的狀態字段。網格數據源傳輸的定義如下:Kendo網格saveChanges()不起作用
transport: {
read: {
url: "/agent/AgentList",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
},
update: {
url: "/agent/UpdateAgent",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
}
},
定製的命令被定義爲以下:
{
command: [
{
name: "accept",
visible: function(dataItem) {
return dataItem.StatusId === 1;
},
text: "@T("Ralfeus.Agent.Accept")",
click: function(e) {setOfferResponse(this, e, 2);}
}
]
}
在實際設置字段中的功能被定義爲以下:
function setOfferResponse(grid, sender, response) {
sender.preventDefault();
var dataItem = grid.dataItem($(sender.currentTarget).closest("tr"));
dataItem.StatusId = response;
grid.editRow($(sender.currentTarget).closest("tr"));
grid.saveChanges();
}
我預期saveChanges()調用來觸發數據源傳輸的更新方法。但它既不會導致對服務器的任何請求,也不會報告錯誤
我也嘗試用grid.dataSource.sync()替換grid.saveChanges()(順便說一下 - 有什麼區別?),正如here建議的那樣,但結果是一樣的:沒有HTTP請求,沒有錯誤。
@ - >你可以看到控制檯上的錯誤? –
否。沒有錯誤報告。 – Ralfeus