2
我想獲得選定的行「ID」,但它只是失敗......我完全不知道這裏發生了什麼。 MVC HTML代碼:MVC Kendo UI Grid =自定義按鈕不能返回選定的行ID
@(Html.Kendo().Grid(Model)
.Name("grid")
.HtmlAttributes(new { style = "margin-top: 5px" })
.Columns(c =>
{
c.Bound(model => model.mgID);
c.Command(com => { com.Custom("Edit").Click("Edit");});
})
.Pageable()
.Sortable()
.Selectable()
.DataSource(d => d
.Ajax()
.PageSize(20)
.Model(model => model.Id(i => i.mgID))
.Read(r => r.Action("Manage_Read", "Manage"))
.Destroy(o => o.Action("Manage_Destroy", "Manage"))
)
)
JavaScript代碼:
function Edit() {
var grid = $("#grid").data("kendoGrid");
var row = grid.select();
var selectedRowIndex = row.index(); //Return "-1"
var dataItem = grid.dataItem(row); //Return "Undefined"
}
請告訴我,我究竟錯過了?
雅,你是對的....我只是在最後20分鐘前發現..非常感謝你 – user2402624