任何人都可以建议我实现以下分页。
1 2 3 4 5 next>>
假设您点击“下一个>>”它应该显示下面的下一组分页
6 7 8 9 10 next>>
和控制应该在第6页
情形:
1 2 3 4 5 next>>
如果我们在任何页面中并点击next>>
应该转到第6页,即下一页的第1页
ex :如果我们在第2页,next>>
应该转到第6页或第3页next>>
转到第6页?
提前致谢。
答案 0 :(得分:0)
如果您查看了pagingbar.isml,则有几个有用的代码段
current = pdict.pagingmodel.start;
totalCount = pdict.pagingmodel.count;
pageSize = pdict.pagingmodel.pageSize;
pageURL = pdict.pageurl;
currentPage = pdict.pagingmodel.currentPage;
maxPage = pdict.pagingmodel.maxPage;
然后您可以通过
定义下一组分页lr = 2; // number of explicit page links to the left and right
if ( maxPage <= 2*lr )
{
rangeBegin = 0;
rangeEnd = maxPage;
}
else
{
rangeBegin = Math.max( Math.min( currentPage - lr, maxPage - 2*lr ), 0 );
rangeEnd = Math.min( (rangeBegin + (2*lr)), maxPage );
}