如何在wordpress网站上为boostrap表创建真正的分页?

时间:2019-07-03 15:56:09

标签: jquery datatable bootstrap-4

  

我创建了一个引导表,该表的末尾将有20000行,但是问题是创建的分页只是模仿分页,并且我所有的数据都上传了一次,并且花了一些时间。我想为我的图书馆创建真正的分页。谢谢您的支持。

  <!doctype html>

<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">

    <title>TABLE DENEME</title>
  </head>
  <body>
    <h1>TABLE DENEME</h1>
    <div class="table-responsive">
    <table class="table" id="mydatatable">
  <thead>
    <tr>
      <th scope="col">ID</th>
      <th scope="col">NAME</th>
      <th scope="col">YEAR</th>
      <th scope="col">CATEGORIES</th>
      <th scope="col">TAGS</th>
      <th scope="col">Type</th>
      <th scope="col">DOWNLOAD LINK</th>
    </tr>
  </thead>
  <tbody>


    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
        <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>

    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
      <tr>
      <th scope="row">4</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
      <tr>
      <th scope="row">5</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
      <tr>
      <th scope="row">6</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
      <tr>
      <th scope="row">7</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
 <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
      <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
      <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
      <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
      <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
      <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
      <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
      <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    <td>@mdo</td>
        <td>@mdo</td>
        <td>@mdo</td>
    </tr>
      </tbody>

</table>
</div>

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script type="text/javascript">
$(document).ready( function () {
    $('#mydatatable').DataTable();
} );
</script>

  </body>
</html>
  

我的代码在上方,如您所见。我只是想为我的图书馆创建一个真正的分页。我还为新的想法开放,以便使此表适用于我的网站。

0 个答案:

没有答案