Hello all,
So, as the title states I am having an issue where my grid's CRUD operations all perform GET requests instead of POST, PUT, and DELETE.
Here is my grid and datasource:
@model ERMgtProgram.Models.ProductViewModels.GradeGroupViewModel
@{
ViewBag.Title = "Grade Group";
}
<
h2
>@ViewBag.Title</
h2
>
@(Html.Kendo().Grid<
ERMgtProgram.Models.ProductViewModels.GradeGroupViewModel
>()
.Name("gradeGroupGrid")
.Columns(columns =>
{
columns.Bound(c => c.GradeGroups).Width(140);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
})
.ToolBar(toolbar =>
{
toolbar.Create();
})
.HtmlAttributes(new { style = "height: 700px;" })
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(new int[] { 10, 20, 50, 100, 250, 1000 })
.ButtonCount(5)).Navigatable()
.Selectable(selectable =>
{
selectable.Mode(GridSelectionMode.Multiple);
selectable.Type(GridSelectionType.Row);
})
.Sortable(sortable =>
{
sortable.SortMode(GridSortMode.MultipleColumn);
})
.Filterable()
.Scrollable()
.DataSource(dataSource => dataSource
.Custom()
.Batch(true)
.PageSize(50)
.Schema(schema => schema.Model(m => m.Id(p => p.GradeID)))
.Transport(transport =>
{
transport.Read(read =>
read.Url("http://localhost:62664/api/gradegroup")
.DataType("jsonp")
.Type(HttpVerbs.Get)
);
transport.Create(create =>
create.Url("http://localhost:62664/api/gradegroup/create")
.DataType("jsonp")
.Type(HttpVerbs.Post)
);
transport.Update(update =>
update.Url("")
.DataType("jsonp")
.Type(HttpVerbs.Put)
);
transport.Destroy(destroy =>
destroy.Url("")
.DataType("jsonp")
.Type(HttpVerbs.Delete)
);
})
)
)
<
script
>
$(function() {
var grid = $("#gradeGroupGrid").data("kendoGrid");
grid.dataSource.transport.options.update.url = function (data) {
return "http://localhost:62664/api/gradegroup/update/" + data.models[0].GradeID;
}
grid.dataSource.transport.options.destroy.url = function(data) {
return "http://localhost:62664/api/gradegroup/delete/" + data.models[0].GradeID;
}
});
</
script
>
My datasource is making calls to a remote WebAPI. The read method works, and the data popluates the grid just fine; but, for my create, update, and destroy methods the datasource sends GET requests even after I specify the "Type" on the various transport methods. I have been at this for some time, and it seems like it should work, but it just doesn't change my request types.
I attached a screenshot of the response.
Any help would be greatly appreciated.
Ruben