滚动时缺少剑道网格错误



我有一个带滚动的简单剑道网格。它在开始时显示20个项目,当滚动时,它会动态地获得更多数据并添加到网格中。

通常情况下,当网格加载时,当dataService抛出如下异常时,获取第一页的数据:

return new HttpStatusCodeResult((int)HttpStatusCode.ServiceUnavailable, this.T("System Error - retrying.").Text);

和我的js方法绑定在配置中

Events(events => events.Error("acc.mp.gridErrorDialog"))

抓住它并显示正确的信息。

问题出在下一页,当网格获取更多数据时。我已经看到,当我触摸滚动并像3行一样滚动时会发生这种情况(即使认为页面大小是20),当我滚动20个项目时,网格试图将数据获取到缓冲区以显示它们。

但当这个操作中发生错误时,就像第一个查询中一样,Kendo网格不会立即显示它(因为我还没有搜索到20行,只有20行保留在缓冲区中),什么也没发生,当我滚动到20行时,微调器显示和所有freze。Method acc.mp.gridErrorDialog未被激发。

网格初始化:

public static GridBuilder<T> InitializeGrid<T>(this GridBuilder<T> gridBuilder, string gridName, string dataBindAction, string controllerName, object routeValues) where T : class
        {
            if (gridBuilder == null)
            {
                throw new ArgumentNullException("gridBuilder");
            }
            return
                gridBuilder
                .Name(gridName)
                .TableHtmlAttributes(new { Class = "styled", cellpadding = "0", border = "0", margin = "0" })
                .HtmlAttributes(new { Class = "dynamicGridHeight" })
                .AutoBind(false)
                .DataSource(
                            dataSource =>
                            dataSource.Ajax()
                            .PageSize(ModelPortfolioConfigurationManager.GridPageSize)
                            .ServerOperation(true)
                            .Events(events => events.Error("acc.mp.gridErrorDialog"))
                            .Read(read => read.Action(dataBindAction, controllerName, AddAntispinnerParameter(routeValues))));
        }

和网格:

@(Html.Kendo()
    .Grid<ValidatedClientAccountViewModel>()
        .InitializeGrid(Naming.GridId(GridType.Upper), "GetClients, "ModelClients", new { modelTemplateId = Model.ModelId })
                    .DataSource(dataSource => dataSource
                    .Ajax()
                    .Model(model => model.Id(o => o.AccountId)))    
    .ToolBar(toolBar => toolBar.Template(
        @<text>
             <script type="text/javascript">
                 acc.mp.utils.bindLiveSearch($("#@Naming.GridId(GridType.Upper) input[name='txtSearch']"), function () { $("#@Naming.GridId(GridType.Upper) button[name='btnSearch']").click(); });                 
                 acc.mp.utils.searchGridFocus($("#@Naming.GridId(GridType.Upper) input[name='txtSearch']"));
             </script>
            </text>))
            .Columns(columns =>
            {
                columns.Bound(o => o.AccountId)
                    .ClientTemplate(ClientTemplates.UpperGridRowSelection)
                    .HtmlAttributes(new { style = "text-align: center" })
                    .HeaderTemplate(ClientTemplates.SelectAllCheckBox("cbLinkAll"))
                    .HeaderHtmlAttributes(new { style = "text-align: center" })
                    .Filterable(true)
                    .Sortable(false)
                    .Width(35);
                columns.Bound(o => o.ClientReferenceNumber).Title(accountReference).HeaderHtmlAttributes(new { title = accountReference });
            })
            .EnableScrollingAndPaging(ModelPortfolioConfigurationManager.GridPageSize)
            .Sortable()
            .Events(events =>
            {
                events.DataBinding("acc.mp.clientAccounts.upperGrid.dataBinding");
                events.DataBound("acc.mp.clientAccounts.upperGrid.dataBound");
                events.Change("acc.mp.clientAccounts.upperGrid.rowSelect");
            })
            )

这是剑道中的一个错误,您可以在这里跟踪问题的状态https://github.com/telerik/kendo-ui-core/issues/749

最新更新