根据记录的数量显示分页

display pager depending upon the number of records

本文关键字:显示 分页 记录      更新时间:2023-09-26

我使用剑道网格。我定义了

$("#grid").kendoGrid({
            dataSource:datasource, 
           pageable: true,
            columns: [
                    { field: "ProductId", title: "ProductId" },
                    { field: "ProductType", title: "ProductType" },
                    { field: "Name", title: "Name" },
                    { field: "Created", title: "Created" }
                ],
          });
    });

我能够在我的网格中显示寻呼机。但是我想要的是,如果在网格中的记录超过20,那么只有我想显示分页,否则不想显示分页,你能告诉我如何做到这一点吗?

基本上不支持。您可以尝试使用一些JavaScript来解决这个问题。例如,在初始化Grid之后,下面的脚本应该实现类似的行为:

$(function(){
     if($('#gridName').data().kendoGrid.dataSource.total()>20){
          $('#gridName .k-grid-pager').hide();
     }
})