我使用SPRY分页来对XML数据集进行分页。假设我在数据集中有数千行,然后SPRY分页显示100页。这迫使我的页面水平滚动,这是我不想要的效果。我如何才能实现如下所示的内容或类似的内容:
<< < 1 2 3 4 5 .. 100 > >>我已经试了好几天了。
请帮我找到一个解决方案。
谢谢
var myOspatches = new Spry.Data.XMLDataSet("include/myxml.xml", "system/ospatches/patch");
var myOspatchesPage = new Spry.Data.PagedView( myOspatches ,{ pageSize: pSize , forceFullPages:true, useZeroBasedIndexes:true});
var myOspatchesPageInfo = myOspatchesPage.getPagingInfo();这就是分配大量页面的分页方式。
<table id="osPatchesPagination" style="width:100%;display: none;">
<tr>
<td align="left">
<!--<pre> <input type="button" class="btn" value="First" onclick="myOspatchesPage.firstPage();" /> <input type="button" class="btn" value="Prev" onclick="myOspatchesPage.previousPage();"/></pre>-->
<pre> <a href="javascript:myOspatchesPage.firstPage();"><<</a> <a href="javascript:myOspatchesPage.previousPage();"><</a> </pre>
</td>
<td align="center">
<span spry:region="myOspatchesPageInfo" spry:repeatchildren="myOspatchesPageInfo">
<a spry:if="{ds_CurrentRowNumber} != {ds_RowNumber}" href="#" onclick="myOspatchesPage.goToPage('{ds_PageNumber}')">{ds_PageNumber}</a>
<span spry:if="{ds_CurrentRowNumber} == {ds_RowNumber}" class="currentPage">{ds_PageNumber}</span>
</span>
</td>
<td align="right">
<pre> <a href="javascript:myOspatchesPage.nextPage();">></a> <a href="javascript:myOspatchesPage.lastPage();">>></a> </pre>
<!--<pre> <input type="button" class="btn" value="Next" onclick="myOspatchesPage.nextPage();" /> <input type="button" class="btn" value="Last" onclick="myOspatchesPage.lastPage();" /></pre>-->
</td>
</tr>
</table>发布于 2011-06-01 07:35:22
同样,这不是一个完整的答案,但应该给你一个理论上的例子。
在查看文档后,{ds_PageNumber}是实现此功能所必需的。如果你打算只有10个页码,然后对变量进行一些计算,比如:
var currentPageMinus10 = {ds_PageNumber}-10;应该允许你通过将这个链接到一个标签来建立自己的导航栏。
当然,如果当前第- 10页小于1或大于总页数,则需要进行相应的检查和调整。
Documentation
https://stackoverflow.com/questions/6152288
复制相似问题