【问题标题】:Kendo grid error missing when scrolling滚动时缺少剑道网格错误
【发布时间】:2015-03-24 12:17:13
【问题描述】:

我有简单的带有滚动功能的剑道网格。它在开始时显示 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 个项目时,网格试图将数据获取到缓冲区以显示它们。

但是当这个操作发生错误时,就像在第一个查询中一样,剑道网格没有立即显示它(因为我还没有滚动 20 行,只有它保留在他的缓冲区中)并且什么也没发生,当我滚动到 20 行微调器显示和所有冻结。 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");
            })
            )

【问题讨论】:

    标签: kendo-ui telerik kendo-grid kendo-asp.net-mvc


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-28
      • 2013-07-06
      • 1970-01-01
      • 2016-06-12
      • 2013-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多