这是我的剧本
$(document).ready(function () {
dataSource = new kendo.data.DataSource({
transport: {
read:
{
url: "http://dnndev.me:80/DesktopModules/ServicePoint/api/DropData/Drop",
dataType: "json",
},
destroy:
{
url: "http://dnndev.me/DesktopModules/ServicePoint/api/DeleteCategory/DeleteCategorybyid",
type: "DELETE"
},
update:
{
url: "http://dnndev.me:80/DesktopModules/ServicePoint/api/updateCategory/update",
type: "POST",
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return {
models: kendo.stringify(options.models)
};
}
}
},
},
schema:
{
model:
{
id: "CategoryID",
fields: {
CategoryID: { editable: false, nullable: true, type: "number" },
CategoryName: { editable: true, nullable: true, type: "string" },
}
}
}
});
$("#grid1").kendoGrid({
dataSource:dataSource,
editable: "inline",
columns: [
{
field: "CategoryID",
title: "number",
},
{
field: "CategoryName",
title: "Name"
},
{
command: ["edit",
{
name: "destroy",
text: "remove",
}
],
}
],
height: "500px",
pageable: {
refresh: true,
pageSizes: true,
buttonCount: 5
},
}).data("kendoGrid");
});
读取和销毁操作工作正常,但在进行更新时,它甚至没有触发URL(与Inspect元素交叉检查),以及我在POSTMAN中检查了我的服务它工作正常。
答案 0 :(得分:0)
从
中删除type: "POST",
应该是
update:{
url: "http://dnndev.me:80/DesktopModules/ServicePoint/api/updateCategory/update",
type: "POST"
}