¿Cómo configura Jaydata para enviar Publicar / poner en lugar de fusionar / parche
-
21-12-2019 - |
Pregunta
Estoy usando una cuadrícula de Kendoui para mostrar algunos datos.Estoy usando Jaydata para simplificar las operaciones CRUD.
Cuando edito un elemento en una fila y luego haga clic en Actualizar, envía un verbo de combinación en lugar de POST.
En este momento, solo quiero enviar POST en lugar de fusiones.
¿Cómo configuro Jaydata para enviar puestos y publicaciones en lugar de fusiones y parches?
No creo que se importa, pero a continuación es mi código:
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"]
});
};
Solución
Puede reescribir el verbo http para poner / publicar, pero el cuerpo de la solicitud aún sería una solicitud de combinación, puede encontrar ejemplos sobre la reescritura aquí: https://github.com/jaydata/jaydata/issues/111
Si desea descansar, use el proveedor de WEBAPI