如何在 Kendo UI Grid 中动态更改页面大小 [英] How to change page size dynamically in Kendo UI Grid

查看:23
本文介绍了如何在 Kendo UI Grid 中动态更改页面大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am having a Kendo UI grid showing more than 1000 data. I also have a dropdown list for different page size - 15, 25, 50, 100. On selection of a page size, how can we change the page size of Kendo UI grid?

推荐答案

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

You can set the page size in the combobox change event. (Also see JSBin example.)

$("#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
    }
});

这篇关于如何在 Kendo UI Grid 中动态更改页面大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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