如何在 kendo 网格中获取 onAthleteGridSave/onAthleteGridEdit 中的操作类型
How to get type of action in onAthleteGridSave/onAthleteGridEdit in kendo grid
我有一个 Kendo 网格如下
<% Html.Kendo().Grid<MaintenanceAthletesAthleteGridViewModel>()
.Name("Athletes")
.HtmlAttributes(new { style = "height:435px" })
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(a => a.ResourceId))
.Events(e => e.RequestEnd("onRequestEnd"))
.Create(create => create.Action("InsertAthlete", "Maintenance"))
.Read(read => read.Action("AthletesMaintenanceAthleteGridAjax", "Maintenance"))
.Update(update => update.Action("UpdateAthlete", "Maintenance").Data("onAthleteGridUpdate"))
.Destroy(destroy => destroy.Action("DeleteAthlete", "Maintenance").Data("onAthleteGridUpdate"))
)
.Events(events => events
.Save("onAthleteGridSave")
.Edit("onAthleteGridEdit")
)
...
%>
function onRequestEnd(e)
{
if (e.type == "insert" || e.type == "update" || e.type == "destroy") {
$("#Athletes").data("kendoGrid").dataSource.read();
}
}
function onAthleteGridSave(e)
{
if (e.type == "insert")
{ ...}
}
function onAthleteGridEdit(e)
{
if (e.type == "insert")
{ ...}
}
但是 onAthleteGridSave(e) 和 onAthleteGridEdit(e) 中的 e.type 是未定义的,而 onRequestEnd(e) 中的 e.type 是可以的。我的问题是如何在 e 或 onAthleteGridSave/onAthleteGridEdit 中的任何其他地方找到诸如 "insert" 或 "update" 之类的操作类型。谢谢。
我有一个 Kendo 网格如下
<% Html.Kendo().Grid<MaintenanceAthletesAthleteGridViewModel>()
.Name("Athletes")
.HtmlAttributes(new { style = "height:435px" })
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(a => a.ResourceId))
.Events(e => e.RequestEnd("onRequestEnd"))
.Create(create => create.Action("InsertAthlete", "Maintenance"))
.Read(read => read.Action("AthletesMaintenanceAthleteGridAjax", "Maintenance"))
.Update(update => update.Action("UpdateAthlete", "Maintenance").Data("onAthleteGridUpdate"))
.Destroy(destroy => destroy.Action("DeleteAthlete", "Maintenance").Data("onAthleteGridUpdate"))
)
.Events(events => events
.Save("onAthleteGridSave")
.Edit("onAthleteGridEdit")
)
...
%>
function onRequestEnd(e)
{
if (e.type == "insert" || e.type == "update" || e.type == "destroy") {
$("#Athletes").data("kendoGrid").dataSource.read();
}
}
function onAthleteGridSave(e)
{
if (e.type == "insert")
{ ...}
}
function onAthleteGridEdit(e)
{
if (e.type == "insert")
{ ...}
}
但是 onAthleteGridSave(e) 和 onAthleteGridEdit(e) 中的 e.type 是未定义的,而 onRequestEnd(e) 中的 e.type 是可以的。我的问题是如何在 e 或 onAthleteGridSave/onAthleteGridEdit 中的任何其他地方找到诸如 "insert" 或 "update" 之类的操作类型。谢谢。