欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

怎么在jquery中使用pagination.js實(shí)現(xiàn)分頁(yè)-創(chuàng)新互聯(lián)

怎么在jquery中使用pagination.js實(shí)現(xiàn)分頁(yè)?針對(duì)這個(gè)問(wèn)題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問(wèn)題的小伙伴找到更簡(jiǎn)單易行的方法。

創(chuàng)新互聯(lián)公司長(zhǎng)期為上千客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對(duì)不同對(duì)象提供差異化的產(chǎn)品和服務(wù);打造開(kāi)放共贏平臺(tái),與合作伙伴共同營(yíng)造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為博興企業(yè)提供專(zhuān)業(yè)的成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì),博興網(wǎng)站改版等技術(shù)服務(wù)。擁有10年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開(kāi)發(fā)。

添加下載的js和樣式,主要是先添加jquery.js 再添加jquery.pagination.js,我這是下載好的,放在本地

<link rel="stylesheet" href="<%=path%>css/pagination.css" type="text/css">
<script type="text/javascript" src="<%=path%>js/jquery-1.11.3.js"></script>
<script type="text/javascript" src="<%=path%>js/jquery.pagination.js"></script>

表格,用的是c標(biāo)簽,獲取控制器傳過(guò)來(lái)的值

<table width="1052" border=0 align=center cellpadding=2 cellspacing=1
   bordercolor="#799AE1" class=tableBorder>
   <tbody>
    <tr>
     <th align=center colspan=16 >商品顯示</th>
    </tr>

    <tr align="center" bgcolor="#799AE1" >
     <td width="10%" align="center" class=txlHeaderBackgroundAlternate>商品編號(hào)</td>
     <td width="10%" align="center" class=txlHeaderBackgroundAlternate>商品大類(lèi)</td>
     <td width="10%" align="center" class=txlHeaderBackgroundAlternate>商品名稱(chēng)</td>
     <td width="10%" align="center" class=txlHeaderBackgroundAlternate>商品規(guī)格</td>
     <td width="10%" align="center" class=txlHeaderBackgroundAlternate>加權(quán)進(jìn)價(jià)</td>
     <td width="10%" align="center" class=txlHeaderBackgroundAlternate>當(dāng)前售價(jià)</td>
     <td width="10%" align="center" class=txlHeaderBackgroundAlternate>操作</td>

    </tr>


    <c:forEach items="${goodsS}" var="goods">
     <tr bgcolor="#DEE5FA">
      <td align="center" id="goodsId" class="txlrow"><c:out
        value="${goods.goodsId}"></c:out></td>
      <td align=center id="goodsType" class=txlrow><c:out
        value="${goods.goodsType}"></c:out></td>
      <td align=center id="goodsName" class=txlrow><c:out
        value="${goods.goodsName}"></c:out></td>
      <td align=center id="goodsContent" class=txlrow><c:out
        value="${goods.goodsContent}"></c:out></td>
      <td align=center id="goodsPrice" class=txlrow><c:out
        value="${goods.goodsPrice}"></c:out></td>
      <td align=center id="goodsSell" class=txlrow><c:out
        value="${goods.goodsSell}"></c:out></td>
      <td align=center class=txlrow> <input type="button" value="編輯"></td>
     </tr>
    </c:forEach>

   </tbody>
  </table>

<!--分頁(yè)顯示-->
<div id="Pagination"></div>

js

var limit=<%=request.getAttribute("limit")%>;//每頁(yè)顯示多少 條數(shù)據(jù)
 var count=<%=request.getAttribute("count")%>//共多少條數(shù)據(jù)
 var index=<%=request.getAttribute("index")%>;//當(dāng)前記錄數(shù)
$(function(){
 $("#Pagination").pagination(count, {
  items_per_page:limit, // 每頁(yè)顯示多少條記錄
  current_page: Math.ceil(index/limit), //當(dāng)前頁(yè)
  num_display_entries:4, // 分頁(yè)顯示的條目數(shù)
  next_text:"下一頁(yè)",
  prev_text:"上一頁(yè)",
  num_edge_entries:2, // 連接分頁(yè)主體,顯示的條目數(shù)
  callback:handlePaginationClick
 });
});


function handlePaginationClick(new_page_index, pagination_container) {
  var path="<%=ppath%>/goodsManager/searchGoodsBylimit/" + new_page_index*limit;
  $("#goodsForm").attr("action",path );
  $("#goodsForm").submit();
  return false;

}

控制器

@RequestMapping(value = "/searchGoodsBylimit/{index}")
 public String searchGoodsBylimitPst(Model model,
   @ModelAttribute Goods goods, @PathVariable String index,
   HttpServletRequest request) {
  //索引
  if (index == null || index.equals("")) {
   index = "0";
  //從服務(wù)器獲取數(shù)據(jù)
  List<Goods> goodsS = goodsService.selectGoods(goods,
    Integer.parseInt(index), PageParam.limit);


  if (goodsS != null) {
   model.addAttribute("goodsS", goodsS);
  } else {
   model.addAttribute("resultMsg", "沒(méi)有該商品");
  }
  //數(shù)據(jù)總條數(shù)
  int count = goodsService.selectAllCount(goods);
  model.addAttribute("index", index);
  model.addAttribute("count", count);
  model.addAttribute("limit", PageParam.limit);

  System.out.println("第" + index + "數(shù)據(jù)開(kāi)始顯示" + goodsS.size() + "條記錄");
  return "goodsManager/showGoods";
 }

效果圖

怎么在jquery中使用pagination.js實(shí)現(xiàn)分頁(yè)

關(guān)于怎么在jquery中使用pagination.js實(shí)現(xiàn)分頁(yè)問(wèn)題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒(méi)有解開(kāi),可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關(guān)知識(shí)。

本文題目:怎么在jquery中使用pagination.js實(shí)現(xiàn)分頁(yè)-創(chuàng)新互聯(lián)
當(dāng)前鏈接:http://www.chinadenli.net/article8/dcdpop.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)靜態(tài)網(wǎng)站虛擬主機(jī)網(wǎng)站營(yíng)銷(xiāo)網(wǎng)站制作網(wǎng)站設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化