Telerik网格分页不显示其他页码

发布于 2025-01-04 21:31:43 字数 965 浏览 1 评论 0原文

我在我的视图中使用下面的代码,并根据 ajax 请求返回 GridModel。

我检查了 GridModel 值,Total 属性为 21,Data 属性有 10 项。但 Telerik grid 不显示其他页面。分页上只有“1”页码。

什么是问题?

@(Html.Telerik().Grid<SerialListItem>()
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(o => o.Id).Width(100).Hidden();
            columns.Bound(o => o.SerialNo).Width(200);
            columns.Bound(o => o.CreatedDate);
            columns.Bound(o => o.UsedDate);
            columns.Bound(o => o.Name);
            columns.Bound(o => o.Email);
        })
        .DataBinding(dataBinding => dataBinding.Ajax().Select("GetSerials", "Admin"))
        .Resizable(cfg=>cfg.Columns(true))
        .Pageable()
        .Sortable()
        .Filterable()
        .Sortable()
)

编辑:

我意识到了一件事。我已经通过 chrome 开发者工具检查了 ajax 请求。我看到 data 属性中有 10 项,total 属性是 10。呵呵,

我通过调试检查了服务器端的 Total 属性,它是 21 那么序列化后怎么会是 10 呢?

I am using below code in my view and i am returning GridModel on ajax request.

I have checked GridModel values and Total property is 21 and Data property has 10 items. But Telerik grid does not show other pages. There is only "1" page number on pagination.

What is problem ?

@(Html.Telerik().Grid<SerialListItem>()
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(o => o.Id).Width(100).Hidden();
            columns.Bound(o => o.SerialNo).Width(200);
            columns.Bound(o => o.CreatedDate);
            columns.Bound(o => o.UsedDate);
            columns.Bound(o => o.Name);
            columns.Bound(o => o.Email);
        })
        .DataBinding(dataBinding => dataBinding.Ajax().Select("GetSerials", "Admin"))
        .Resizable(cfg=>cfg.Columns(true))
        .Pageable()
        .Sortable()
        .Filterable()
        .Sortable()
)

Edit:

I have realized a thing. I have checked ajax request via chrome developer tools. I saw that there is 10 item in data property and total property is 10. Huhhh

I have checked Total property in server side by debugging and it is 21 so how it can be 10 after serialized ??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅紫色的梦幻 2025-01-11 21:31:43

只需将 GridAction 属性更改为 GridAction(EnableCustomBinding=true) 即可按预期工作。

但还是不明白为什么。文档没有指出这一点。请检查
Telerik 分页演示

    [GridAction(EnableCustomBinding=true)]
    public ActionResult GetSerials(GridCommand command)
    {

        GridModel model = service.GetSerials(command);

        return View(model);
    }

Just change GridAction attribute to GridAction(EnableCustomBinding=true) and it works as it is expected.

But still couldn't understand why. Documentation does not point about it. Please check
Telerik pagination demo

    [GridAction(EnableCustomBinding=true)]
    public ActionResult GetSerials(GridCommand command)
    {

        GridModel model = service.GetSerials(command);

        return View(model);
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文