I've been trying to get this working for a few days and no solution. I have a [delete] button on each row of my grid and when I click it, it never calls the destroy method in the data source. I have the same issue when trying to create as well, Read works fine: Am I missing something, wrong format, etc.
Datasource:
var ds = new kendo.data.DataSource({
transport: {
create:
{
url: '@Url.Action ("CreateSales", "Sales", new { area = "sales"})',
datatype: "JSON",
type: "POST",
cache: false,
complete: function(xhr, status)
{
$("#sales").data.('kendoGrid').datasource.read();
}
},
destroy:
{
url: '@Url.Action("RemoveSales", "Sales", new { area = "sales"})',
datatype: "JSON",
type: "POST",
complete: function(xhr, status) {
$("#sales").data('kendoGrid').datasource.read();
}
} ,
parameterMap; function (items)
{ return $.param(items);
}
}
});
$("#sales").kendoGrid(
{
dataSource: ds,
pageable: true,
scrollable: true,
sortable: {
mode: 'multiple'
},
height: 440,
toolbar: [{ name: "create", text: "Save" },
],
columns: [
{ field: "Name", title: "Name", width: "300px" },
{ field: "Location", title: "Location" },
{ command: ["destroy"], title: " ", width: "100px" },
]
});
and the method in the controller: the delete/destroy never calls this
[httpPost]
public JsonResult RemoveSales(Sales items)
{
//calls stored procedure to delete the user
}