如何检测kendo网格中的keydown / keypress

时间:2015-01-12 13:39:12

标签: jquery asp.net-mvc kendo-grid keydown

我想在kendo网格中检测keydown / keypress来编辑或删除行 网格,但我的网格没有在jquery中定义。

数据源使用控制器中的json发送到网格

<div id="ParamsDb">
    @(Html.Kendo().Grid<ParamKendo.Models.parametric>()
        .Name("gridDetail")
        .Columns(columns =>
        {
            columns.Bound(c => c.kodfarei).Width(50).Title("کد");
            columns.Bound(c => c.sharh).Width(150).Title("شرح");
            columns.Command(command =>
            {
                command.Edit().Text("ویرایش").UpdateText("ثبت").CancelText("انصراف");
                command.Destroy().Text("حذف");
            }).Width(172);
        })
        .HtmlAttributes(new { style = "height: 380px;" })
        .ToolBar(toolbar => toolbar.Create().Text(" جدید "))
        .Editable(editable => editable.Mode(GridEditMode.InLine))            
        .Sortable()
        .Resizable(rl => rl.Columns(true))                                
        .Selectable(sl => sl.Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5)
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(20)
            .Model(model => model.Id(p => p.adder))
            .Create(create => create.Action("Create", "Home", new { intParent = ViewBag.IntParent }))
            .Read(read => read.Action("GetDetail", "Home", new { intParent = ViewBag.IntParent }))
            .Update(update => update.Action("Inline_Update", "Home"))
            .Destroy(delete => delete.Action("Inline_Destroy", "Home"))
        )
    )
    </div>

    $("#gridDetail").on("keyPress", " tbody > tr", function (e) {
        alert("1");
    });

0 个答案:

没有答案