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

查看:123
本文介绍了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"))
)

)

谢谢

推荐答案

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天全站免登陆