Kendo UI - 网格分页(服务器端) [英] Kendo UI - Grid pagination (server side)

查看:24
本文介绍了Kendo UI - 网格分页(服务器端)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用带分页的 Kendo-UI 网格.一切似乎都适用于 Total 属性,尽管我将其设置为 100,但它显示了我正在设置的页面大小的 10 个项目中的 1 - 10 个.有人在这方面取得了更好的成功吗?我搜索了 Kendo 文档和论坛,但没有成功.

I'm trying to use Kendo-UI grid with pagination. everything seems to work expect for the Total attribute, although I set it to 100 it shows 1 - 10 of 10 items which the page size i'm setting. Anyone had better success with this? I searched Kendo docs and forums with no success.

@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
    foreach (System.Data.DataColumn column in Model.Columns)
    {
        columns.Bound(column.ColumnName);
    }
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.Groupable()
.DataSource(dataSource => dataSource
    .Ajax()
    .PageSize(10)
    .Total(100)
    .Model(model =>
        {
            foreach (System.Data.DataColumn column in Model.Columns)
            {
                model.Field(column.ColumnName, column.DataType);
            }                
        })
    .Read(read => read.Action("Read", "Controls"))
)

)

谢谢

推荐答案

如文档中所述,当启用 serverPaging 时,您需要在架构中指定总计,并且每次从服务器返回响应时,您还需要返回该总计架构指定的这个地方.

As explained in the documentation when serverPaging is enabled you need to specify total in your schema and you also need to return that total each time you return response from the server exactly at this place specified by the schema.

 dataSource: {
    serverPaging: true,
    schema: {
        data: "data",
        total: "total"
    },
  //...

同样讨论 这里.

检查以下示例.

这篇关于Kendo UI - 网格分页(服务器端)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆