I have a newly created Telerik project to which I've only added Entity Framework and WebAPI. I've used the KendoUI scaffolder to create a simple Grid from a very simple model (and hopefully corrected the errors in the scaffolder in the latest version). Read (GET) and Create (POST) work fine, but Update and Delete doesn't work. When trying to do Update or Delete, I get:
kendo.all.min.js:9 "Uncaught TypeError: e.replace is not a function"
Any idea of what is wrong? I am quite sure it is something quite simple.
I've attached code below
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
height: 400,
columns: [
{field: "Name"},
{command: [ "edit" , "destroy"], width: 180 }
],
toolbar: ["create"],
dataSource: {
type: "webapi",
transport: {
create: {
url: "/api/AccommodationTypes/",
contentType: "application/json",
type: "POST"
},
read: {
url: "/api/AccommodationTypes/",
contentType: "application/json"
},
update: {
url: function (accommodationType) {
return "/api/AccommodationTypes/" + accommodationType.id;
},
contentType: "application/json",
type: "PUT"
},
destroy: {
url: function (accommodationType) {
return "/api/AccommodationTypes/" + accommodationType.id;
},
contentType: "application/json",
type: "DELETE"
},
parameterMap: function (data, operation) {
return JSON.stringify(data);
}
},
schema: {
data: "Data",
total: "Total",
errors: "Errors",
model: {
id: "Id",
fields: {
Id: { type: "number"},
Name: { type: "string"}
}
}
},
serverPaging: true,
serverSorting: true,
serverFiltering: true,
serverGrouping: true,
serverAggregates: true,
},
editable: "inline",
selectable: "single row",
filterable: {
mode: "row"
},
scrollable: true
})
</script>