【问题标题】:Pagination is not working for table concept分页不适用于表格概念
【发布时间】:2013-12-23 19:12:02
【问题描述】:

我想为下面的 jsp 表实现分页,其中名称、标题和流派将从数据库中检索。我想每页列出 1 个数据。

在标题中我使用了以下代码

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="/Fileupload/js/jquery.paginate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $('#paging_container3').pajinate({
    num_page_links_to_display : 1,
    items_per_page : 1,
  }(jQuery));
  });   
</script>

在 jsp 文件中我有以下代码

<div id="paging_container3">
  <table border="1" id="myTable">
    <tbody>
        <tr>
          <td><b>Name</b></td>
          <td><b>Title</b></td>
          <td><b>Genre</b></td>
          <%  
            while(rs.next())
            {
               String name = rs.getString("Name");
               String title = rs.getString("Title");
               String genre = rs.getString("Genre");
           %>
          <tr><td><%=name %></td><td><%=title %></td><td><%=genre %></td></tr>
           <%   
            }
            %>
      </tbody>
   </table>
  </div>

谁能建议我必须集中精力解决问题。在此先感谢

【问题讨论】:

  • 你能详细说明不工作吗?你有什么错误吗?
  • 我得到的错误是({num_page_links_to_display:1, items_per_page:1}) is not a function
  • 您检查过您的表格行吗?未正确关闭。

标签: jquery jsp pagination


【解决方案1】:

请确保您遵循这些,并检查您的pajinate.js 路径。

DEFAULT USAGE
---------------------------------
1) Place pajinate-x.x folder somewhere in your website directory structure.
2) Include script tags for the desired version of the script. 
3) Create at least one <div> in your HTML with a CSS class 
value of "page_navigation".  The navigation links will be 
attached to these divs.
4) Ensure that all items you would like to page through are 
all the first-children of an HTML element with a CSS 
class value of "content". The child-elements can be of any tag type.
5) Call the Pajinate plugin with the function.

有关详细信息,请访问此链接。 https://github.com/wesnolte/Pajinate。可能是你的 html 需要看起来像这样,

<div id="page_container">
<div class="page_navigation"></div>     
        <ul class="content">
            <li> <p>One</p> </li>
        <li> <p>Two</p> </li>
        <li> <p>Three</p> </li>
        <li> <p>Four</p> </li>
        <li> <p>Five</p> </li>
        <li> <p>Six</p> </li>
        <li> <p>Seven</p> </li>
        <li> <p>Eight</p> </li>
    </ul>
  </div>    
</div>

【讨论】:

  • 感谢 vinoth 我错过了上面列出的点中的 3 点。现在问题解决了。
  • 不客气,将此标记为答案。所以其他人会利用这个答案。
猜你喜欢
  • 1970-01-01
  • 2022-10-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-09
  • 1970-01-01
  • 1970-01-01
  • 2023-03-27
相关资源
最近更新 更多