如何在Kendo UI Grid中动态更改页面大小

Ash*_*mah 18 kendo-ui kendo-grid

我有一个显示超过1000个数据的Kendo UI网格.我还有一个不同页面大小的下拉列表--15,25,50,100.在选择页面大小时,我们如何更改Kendo UI网格的页面大小?

Ric*_*los 21

这是使用ASP.NET MVC Helper的最新版本

.Pageable(pager => pager.PageSizes(new int[] {20, 50, 100})) // Enable paging
Run Code Online (Sandbox Code Playgroud)


Dan*_*iel 17

您可以在组合框更改事件中设置页面大小.(另见JSBin示例.)

$("#comboBox").kendoComboBox({
    dataTextField: "text",
    dataValueField: "value",
    dataSource: [
        { text: 1 },
        { text: 2 },
        { text: 3 },
        { text: 4 },
        { text: 5 }
    ],
    change: function(e) {
      var grid = $("#grid").data("kendoGrid");
      grid.dataSource.pageSize(parseInt(this.value()));  // this.value() being the value selected in Combo
    }
});
Run Code Online (Sandbox Code Playgroud)


Cra*_*gly 14

它还通过在js中执行以下操作而内置到最新版本的网格中

pageable: {
    pageSizes: [10, 25, 50, 100]
}
Run Code Online (Sandbox Code Playgroud)

http://docs.kendoui.c​​om/api/web/pager