I am trying to use a grid with a RESTful web service as a datasource. The read operation is working fine but the create operation is issuing a post with an empty body where I am expecting a JSON object. Any suggestion on debugging this or what I am doping wrong. Code below:
$(document).ready(function()
{
var gridDataSource = new kendo.data.DataSource({
transport: {
read: {
url: "/saml-sp/secure-api/ecs/AccountDataService/v1/AccountData/19610505/OrganizationalUnit",
type: "get",
dataType: 'json'
},
create: {
url: "/saml-sp/secure-api/ecs/AccountDataService/v1/AccountData/19610505/OrganizationalUnit",
type: "post",
contentType : 'application/json',
dataType: 'json'
},
update: {
url: "/saml-sp/secure-api/ecs/AccountDataService/v1/AccountData/19610505/OrganizationalUnit",
type: "put",
contentType : 'application/json',
dataType: 'json'
},
parameterMap : function(options, operation) {
if (operation !== "read" && options.models) {
return kendo.stringify(options.models);
}
}
},
schema: {
model: {
id: "id",
fields: {
id: {
editable : false,
nullable : false
},
clientName: {type: "string"},
friendlyClientName: {type: "string"},
name: {type: "string"},
status: {type: "string"}
}
}
}
});
$("#ouGrid").kendoGrid({
dataSource: gridDataSource,
toolbar: ["create"],
messages: {
commands: {
create: "Add Organizational Unit"
}
},
editable: "popup",
columns: [
{ title: "Client", field: "clientName", width: 100 },
{ title: "Friendly Name", field: "friendlyClientName", width: 100 },
{ title: "Organizational Unit", field: "name", width: 100 },
{ title: "Status", field: "status", width: 100 }
],
groupable: true,
selectable: "multiple row",
sortable: true,
filterable: true,
allowCopy: true,
height: 450,
});
});