开发者

tablesorter.pager plugin

The number of returned results is 2 which is correct and it comes up with 2 for the number of pages which is also correct but instead of showing 1 on the first page it shows both records. I'm not sure hwy the tablesorter.pager plugin is doing that.

<?php
  session_start();
  require("../inc/dbconfig.php");
  require("../inc/global_functions.php");
  require("../inc/variables.php");

  // find out how many rows are in the table
  $query = "SELECT CONCAT_WS(' ',firstName,lastName) AS name, username, emailAddress, userID FROM manager_users WHERE statusID != 4";
  $res开发者_开发百科ult = mysqli_query($dbc,$query);
  $rows = mysqli_num_rows($result);
$itemsPerPage = 1;
  $totalPages = ceil($rows/$itemsPerPage);

  $fileName = basename($_SERVER[PHP_SELF]);
  $pageName = "User Accounts";
  $userData = $_SESSION['user_data'];
  $userID = $userData['userID'];
  ?>

  <script type="text/javascript">
  $(document).ready(function() {

      $('#usersPageList').tablesorter().tablesorterPager({sortlist: [0,0], container:$('#usersPageList .pagination'),cssPageLinks:'a.pageLink'});

      $('a.bt_green').click(function(e) {
          e.preventDefault();
          $('div.right_content').load('forms/addnew/' + $(this).attr('id'));
      });

      $('.ask').jConfirmAction();    

  });
  </script>

  <h2>User Accounts</h2>

  <table id="usersPageList" class="rounded-corner">

      <thead>

          <tr>

              <th scope="col" class="rounded-first"></th>
              <th scope="col" class="rounded">Name</th>
              <th scope="col" class="rounded">Email Address</th>
              <th scope="col" class="rounded">Username</th>
              <th scope="col" class="rounded">Edit</th>
              <th scope="col" class="rounded-last">Delete</th>

          </tr>

      </thead>

      <tfoot>

          <tr>

              <td colspan="5" class="rounded-foot-left"><em>Displays all of the registered and verified users!</em></td>
              <td class="rounded-foot-right">&nbsp;</td>

          </tr>

      </tfoot>

      <tbody>

          <?php
          while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
              echo "<tr>";
                  echo "<td><input type=\"checkbox\" name=\"\" /></td>";
                  echo "<td>".$row['name']."</td>";
                  echo "<td>".$row['emailAddress']."</td>";
                  echo "<td>".$row['username']."</td>";
                  echo "<td><a href=\"#\"><img src=\"images/user_edit.png\" alt=\"\" title=\"\" border=\"0\" /></a></td>";
                  echo "<td>";
                  if (($row['userID'] !== '10000') && ($row['userID'] !== $userID)){
                      echo "<a href=\"#\" class=\"ask\"><img src=\"images/trash.png\" class=\"delete\" alt=\"\" title=\"\" border=\"0\" id=\"".$row['userID']."\" /></a>";
                  }
                  echo "</td>";
              echo "</tr>";
          }
          ?>

      </tbody>

  </table>

  <?php
  addRemove($fileName,$pageName);
  pagination($totalPages);
  ?>
  <input type="hidden" name="myhiddenPageToken" id="myhiddenPageToken" value="useraccounts" />


Maybe I'm misunderstanding what you want, but I think you want just one record at a time to show on the page? I have no idea why you would do that, but you can use the pager's size option:

$("table").tablesorter({
    widthFixed: true,
    widgets: ['zebra']
}).tablesorterPager({
    container: $("#pager"),
    size: 1 // only show one record
});

Also, if you are using the select to change the number of records showing, you'll need to include a "1" (demo).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜