0

最近、試用期間の終了時に購入できるように、Kendo UI スイートの試用版をダウンロードしました。Ajax バインディング モードで Kendo グリッド コントロールを使用していますが、いくつかの問題に気付きました。主な問題は、グリッドにバインドされているモデルの最後のレコードを削除するときに、次のスクリプト エラーが発生することです。

http:// * * /Scripts/kendo/2012.3.1114/kendo.web.js 0x800a138fの行 18、列 31059 で未処理の例外- Microsoft JScript ランタイム エラー: '_current' は null またはオブジェクトではありません

これを Chrome で複製することはできません。IE8と互換性があるとして販売されているKendoに興味があります。そうではないようです。

.cshtml ファイルのグリッドは次のとおりです。

@(Html.Kendo().Grid(Model)
    .Name("UserGrid")
    .HtmlAttributes(new { style = "height:500px" })
    .Columns(columns =>
    {
        columns.Bound(p => p.ReferenceNumber).Groupable(false);
        columns.Bound(p => p.Title).Title("Title");
        columns.Bound(p => p.AgreementDate).Title("Agreement Date");
        columns.Bound(p => p.Superseded).ClientTemplate(
        "<input type='checkbox' disabled='disabled' value='#= Superseded #' " +
            "# if (Superseded) { #" +
                "checked='checked'" +
            "# } #" +
        "/>");

        //columns.Bound(p => p.Parties.Count);
        columns.Bound(p => p.SourceDocumentLink);
        columns.Bound(p => p.RelationshipLeadDirector);
        columns.Bound(p => p.Owner);
        columns.Bound(p => p.LegalContact);
        columns.Command(command => command.Destroy()).Width(100);
        columns.Template(@<text></text>).ClientTemplate("<a class='k-button k-button-icontext k-edit-button' href='" + Url.Action("Update", "Agreement") + "/#=Id#'><span class='k-icon k-edit'></span>Edit</a>");        
    })
    .DataSource(dataSource => dataSource
        .Ajax()
        //.Server()
        //.Events(events => events.RequestStart("requeststart_handler"))
        //.Events(events => events.Error("error_handler"))              
        .Model(model => model.Id(p => p.Id))
        .Destroy("Delete", "Agreement")
        .Update("Update","Agreement")        
        .Read(read => read.Action("ListAgreements", "Agreement")
        ))
    .Navigatable()
    .Scrollable()
    .Resizable(s=>s.Columns(true))
    .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
    .Sortable()
    .Pageable(builder => builder.PageSizes(true))
      )

そして、削除を処理するコントローラーのアクションは次のとおりです。

[HttpAjaxPost]
public JsonResult Delete([DataSourceRequest] DataSourceRequest request, AgreementData agreement)
{
    try
    {
        _agreementService.DeleteAgreement(agreement);
        ModelState.Clear();
    }
    catch (Exception ex)
    {
        Logger.GetLog(Logger.ServiceLog).Error(ex);
        ModelState.AddModelError("errors", "Delete failed");
    }
    return Json(ModelState.ToDataSourceResult());
}

これは剣道グリッドのバグですか、それとも明らかな何かを見逃していますか? 要約すると、スクリプト エラーは、グリッド内の最後のレコードを削除するときにのみ発生します。

4

1 に答える 1

0

OK、Tekerik フォーラムでこれを見つけました。

http://www.kendoui.c​​om/forums/mvc/grid/deleting-only-row-on-grid-generates-a-javascript-error-and-doesn-t-execute-the-call-to-the-サーバー.aspx

Kendo の現在のリリース バージョン (2012.3.1114) のバグのようです。どうやら、最新の内部ビルドで修正されているようです。

于 2013-01-23T10:00:41.493 に答える