[英]How to set pagination on the client-side for data display from database?
Hello fellow stackoverflowers, I'm building an e-commerce application in JSP. 大家好,stackoverflowers,我正在JSP中构建一个电子商务应用程序。 All my products are stored on server-side database (Mysql) in a table called
product
. 我所有的产品都存储在服务器端数据库(Mysql)中的表
product
。
All the data product is already fetched/divided in multiple categories on the server-side in a table name category
. 所有数据产品已在服务器端的表名称
category
中的多个类别中获取/划分。
This is the JSP page used to display data on the client-side: 这是用于在客户端上显示数据的JSP页面:
<table class="producTable" style="text-align: left; width: 100%;" cellspacing="40px">
<c:forEach var="product" items="${categoryProducts}" varStatus="iter">
<td>
<tbody>
<tr>
<td style="vertical-align: middle; text-align: center;" class="cell">
<a href="viewProduct?${product.id}">
<img class="img" alt="" src="${initParam.productImagePath}${product.name}.jpg" />
<div class="caption">
<br>view details</div>
</a>
<br>
</td>
<td style="vertical-align: middle; width: 140px; text-align: center; ">${product.name}
<br>
</td>
<td style="vertical-align: middle; width: 120px; text-align: center; line-height:100%;">$${product.price}
<br>
</td>
<td style="vertical-align: middle; width: 136px; text-align: center; line-height:20%;">
<form id="wishlistForm" action="addToWishlist" method="post">
<br>
<br>
<input name="productId" value="${product.id}" type="hidden">
<input class="submit" onclick="addedWishlist()" value="<fmt:message key='AddToWishlist'/>" type="submit">
</form>
<br>
</td>
<td style="vertical-align: middle; width: 136px; text-align: center; line-height:20%;">
<form id="cartForm" action="addToCart" method="post">
<br>
<br>
<input name="productId" value="${product.id}" type="hidden">
<input class="submit" onclick="addedCart()" value="<fmt:message key='AddToCart'/>" type="submit">
</form>
<br>
</td>
</tr>
</tbody>
</c:forEach>
</table>
Now I'd like to dynamically fetch the data on the client-side using pagination. 现在,我想使用分页在客户端动态获取数据。 The options must be:
选项必须是:
I have tried many many JQuery pagination scripts but none of them worked and don't seem to accomplish what I want. 我已经尝试了许多JQuery分页脚本,但是它们都没有起作用,而且似乎无法实现我想要的功能。 There's no need for
<thead>
I just want to fetch partial lists when a user select a given category in the app store. 不需要
<thead>
我只想在用户在应用商店中选择给定类别时获取部分列表。 Do you know any good scripts out there that could help me? 您知道那里有什么好的脚本可以帮助我吗?
What you need is jQuery Datatable plugin: 您需要的是jQuery Datatable插件:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.