我认为问题在于您不能将OnDemandGrid 与分页一起使用,因为OnDemandGrid 有它自己的内部虚拟分页逻辑。来自dgrid extensions wiki:
与 OnDemandList 和 OnDemandGrid 模块相比,
分页扩展实现了经典的离散分页控件。它
在给定时间显示一定数量的结果,并提供
带有用于在页面之间切换的控件的页脚区域。
注意:分页扩展应该混入列表或网格中,而不是
OnDemand 构造函数之一,因为它们包含自己的
虚拟滚动逻辑。在内部,Pagination 继承自同一个
_StoreMixin 模块由 OnDemand 原型继承,用于与 dojo/store 的通用集成。
您想要做的是将Pagination 混入一个普通的Grid。 Pagination Mixin 包含您感兴趣的属性,例如行数。 Paginator 扩展处理与提供的存储的对话,以检索和呈现要显示的行集。像这样的类的 define 可能如下所示:
define(['dojo/_base/declare','dgrid/Grid', 'dgrid/extensions/Pagination'],function(declare,Grid,Pagination){
return declare('mine.PaginatedGrid',[Grid,Pagination],{
//various default you can set
pagingLinks: false,
pagingTextBox: true,
firstLastArrows: true,
minRowsPerPage: 5,
rowsPerPage: 5,
pageSizeOptions: [5, 10, 15, 25, 50, 100]
});
});