2011-07-02 14 views
1

返される結果の数は2であり、正しいページ数で2が表示されますが、最初のページに1が表示されず、両方のレコードが表示されます。私はtablesorter.pagerプラグインがそれをしているかどうかは分かりません。tablesorter.pager plugin

<?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"; 
    $result = 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" /> 

答えて

0

おそらく私はあなたが望むものを誤解しているかもしれませんが、一度に1つのレコードだけをページに表示したいと思いますか?あなたが示すレコード数を変更するために選択を使用している場合、あなたは「含める必要があります、また

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

:私はあなたがページャのsizeオプションを使用することができますが、どうなる理由は分かりません1 "(demo)である。