我正在使用KendoUI网格来显示一些数据。我正在使用JayData来简化CRUD操作。
当我连续编辑一个项目然后点击更新时,它会发送MERGE Verb而不是POST。
现在,我只想发送POST而不是MERGES。
如何配置JayData以发送PUT和POST而不是MERGE和PATCH。
我觉得这不重要,但下面是我的代码:
var baseAssetMgmtURL = "http://localhost/AssetManagementAPI/odata/";
var crudServiceComputerBaseURL = baseAssetMgmtURL + "Computers/";
var computer = $data.define("computer", {
ComputerId: { type: Number, key: true },
AssetTag: Number,
BrandModel: String,
ComputerModelTypeId: Number,
ComputerTypeId: Number,
ComputerType: String,
PurchaseDate: Date,
OperatingSystemTypeId: Number,
OperatingSystemType: String,
ComputerName: String,
Notes: String,
MHIPSConnection: Date,
RetiredDate: Date
});
var ds = computer.asKendoDataSource({
provider: 'oData',
url: crudServiceComputerBaseURL,
batch: false,
pageSize: 10,
serverPaging: false
//,
//transport: { update: { type: "POST" } }
});
var setGrid = function () {
$("#grid").kendoGrid({
dataSource: ds,
columns: [
{ title: "AssetTag", field: "AssetTag", filterable: false },
{
title: "Brand Type", field: "ComputerModelTypeId", filterable: false,
editor: brandTypeDropDownEditor, template: "#= getModelType(ComputerModelTypeId) #"
},
{
title: "Computer Type", field: "ComputerTypeId", filterable: false,
editor: computerTypeDropDownEditor, template: "#= getComputerType(ComputerTypeId) #"
},
{ title: "PurchaseDate", field: "PurchaseDate", filterable: false },
{
title: "OS Type", field: "OperatingSystemTypeId", filterable: false,
editor: osTypeDropDownEditor, template: "#= getOSType(OperatingSystemTypeId) #"
},
{ title: "Name", field: "ComputerName", filterable: false },
{ title: "Notes", field: "Notes", filterable: false },
{ title: "MHIPSConnection", field: "MHIPSConnection", filterable: false },
{ title: "Retired", field: "RetiredDate", filterable: false },
{ command: ["edit"], title: " " }
],
pageable: true,
sortable: false,
scrollable: false,
editable: "inline",
toolbar: ["create"]
});
};
答案 0 :(得分:2)
您可以将http动词重写为put / post但请求正文仍然是合并请求,您可以在此处找到有关重写的示例:https://github.com/jaydata/jaydata/issues/111
如果您想要REST,请使用webapi提供程序