我正在使用kendoui网格来显示一些数据。我正在使用Jaydata来简化Crud操作。

当我连续编辑一个项目然后单击更新时,它会发送合并动词而不是帖子。

现在,我只想发送帖子而不是合并。

如何将jaydata配置为发送puts和posts而不是合并和修补程序。

我不认为它很重要,但下面是我的代码:

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"]
});
.

};

有帮助吗?

解决方案

您可以重写HTTP动词到PUT / POST,但请求的正文仍然是合并请求,可以在此处找到关于重写的示例: https://github.com/jaydata/jaydata/issues/111

如果您想要休息,那么使用WebAPI提供程序

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top