简体   繁体   English

如何控制剑道网格?

[英]How to control the Kendo Grid?

How do I control how many rows appear in a kendo grid? 如何控制剑道网格中出现多少行? Real Estate is limited, so I need to have a lot of info in a pretty compact space. 房地产是有限的,所以我需要在一个非常紧凑的空间中获得很多信息。 I'm trying to pack everything in my grid in a 300-pixel high area. 我正在尝试将网格中的所有内容打包在300像素高的区域中。

The issue I'm having is that all 200-plus rows of data that are being returned from my MVC JsonResult in my controller are displaying at once, on a single page. 我遇到的问题是从控制器中的MVC JsonResult返回的所有200多行数据都一次显示在单个页面上。 Not quite exactly what I'm looking for. 并非完全符合我的要求。

Code is below, if someone a little more knowledgeable about formatting a kendo grid could help out, I'd appreciate it. 代码在下面,如果对格式化剑道网格有更多了解的人可以帮助您,我将不胜感激。

Thanks! 谢谢!

-RC -RC

{} {}

        var RemoteJsonData_Call = new kendo.data.DataSource({
            transport:
            {
                read: {
                    type: "GET",
                    dataType: "json",
                    url: resourceURL_Call
                },
                pageSizes: 8,
                serverPaging: true
            },

            schema: {
                model: {
                    ScheduleData: {
                        extensionDataField: {
                            fields: {
                                ScheduleDate: { type: "date" },
                                ScheduleAmount: { type: "number" },
                                SchedulePrice: { type: "number" },
                                ScheduleNotes: { type: "string" }
                            }
                        }
                    }
                }
            }
        })

        $('#callSched').kendoGrid({
            height: '300',
            sortable: true,
            reorderable: true,
            resizable: true,
            pageable: {
                numeric: true,
                refresh: true,
                pageSizes: true,
                previousNext: true,
                input: true,
                info: true
            },
            columns: [
               {
                   field: "ScheduleDate",
                   title: "Date",
                   template: "#= kendo.toString(kendo.parseDate(ScheduleDate, 'MM-dd-yyyy'), 'MM-dd-yyyy') #"
               },
                {
                    field: "ScheduleAmount",
                    title: "Amount",
                },
                {
                    field: "SchedulePrice",
                    title: "Price"
                },
                {
                    field: "ScheduleNotes",
                    title: "Notes"
                }
            ], dataSource: RemoteJsonData_Call
        });

{} {}

The problem is that you have defined that the paging is done in the server when it is not. 问题是您已定义了在服务器未完成分页的情况下。 You should say: 你应该说:

serverPaging: false

or just nothing since the default value is false . 或什么也没有,因为默认值为false

With this you should have a grid with the number of pixels specified in the height option (in your example 300 pixels). 有了这个,您应该有一个带有在height选项中指定的像素数的网格(在您的示例中为300像素)。 Other options in you example are correct. 您示例中的其他选项是正确的。

You have server paging and page size set up incorrectly here: 您在此处错误地设置了服务器分页和页面大小:

    var RemoteJsonData_Call = new kendo.data.DataSource({
        transport:
        {
            read: {
                type: "GET",
                dataType: "json",
                url: resourceURL_Call
            },
            pageSizes: 8,
            serverPaging: true
        },

It should be: 它应该是:

    var RemoteJsonData_Call = new kendo.data.DataSource({
        transport:
        {
            read: {
                type: "GET",
                dataType: "json",
                url: resourceURL_Call
            }
        },
        pageSize: 8,
        serverPaging: true

The config options were in the wrong place, and "pageSizes" was misspelled, it should be "pageSize" with no "s" on the end. config选项放置在错误的位置,并且“ pageSizes”的拼写错误,应为“ pageSize”,末尾没有“ s”。

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-pageSize http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-pageSize

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM