2011-07-05 50 views
1

任何人都有任何想法爲什麼我的頁碼沒有列在分頁div內?我正在使用tablesorter.pager插件。不顯示頁碼

<?php 
session_start(); 
require("../inc/dbconfig.php"); 
require("../inc/global_functions.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); 

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

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

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

$('#usersPageList').tablesorter().tablesorterPager({container:$('#pagination'),cssPageLinks:'a.pageLink', positionFixed: false}); 

$('table tr').click(function() { 

    checkBox = $(this).children('td').children('input[type=checkbox]'); 

    if(checkBox.attr('checked')) 
     checkBox.removeAttr('checked'); 
    else 
     checkBox.attr('checked', 'checked'); 

}); 

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

$('.ask2').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=\"users[]\" value=\"".$row['userID']."\"/></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> 

<div id="pagination"></div> 

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

編輯帖子:

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

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

$('#usersPageList').tablesorter().tablesorterPager({container:$('#pagination'),cssPageLinks:'a.pageLink', positionFixed: false}); 

$('table tr').click(function() { 

    checkBox = $(this).children('td').children('input[type=checkbox]'); 

    if(checkBox.attr('checked')) 
     checkBox.removeAttr('checked'); 
    else 
     checkBox.attr('checked', 'checked'); 

}); 

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

$('.ask2').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> 

     <tr><td><input type="checkbox" name="users[]" value="10000"/></td><td>KOW Management</td><td>[email protected]</td><td>Administrator</td><td><a href="#"><img src="images/user_edit.png" alt="" title="" border="0" /></a></td><td></td></tr><tr><td><input type="checkbox" name="users[]" value="10001"/></td><td>Jeff Davidson</td><td>[email protected]</td><td>xtremer360</td><td><a href="#"><img src="images/user_edit.png" alt="" title="" border="0" /></a></td><td></td></tr> 

</tbody> 

</table> 

<div id="pagination"></div> 

<a href="" class="bt_green" id="useraccounts.php"><span class="bt_green_lft"></span><strong>Add New User Accounts</strong><span class="bt_green_r"></span></a><a href="" class="bt_blue"><span class="bt_blue_lft"></span><strong>View all User Accounts</strong><span class="bt_blue_r"></span></a><a href="" class="bt_red ask2"><span class="bt_red_lft"></span><strong>Delete User Accounts</strong><span class="bt_red_r"></span></a><input type="hidden" name="myhiddenPageToken" id="myhiddenPageToken" value="useraccounts" /> 
+2

你能張貼在jsfiddle.net最終HTML輸出或者是給我們一個頁面一個鏈接,該頁面被呈現? (因爲這可能是JavaScript和/或HTML結構問題)。謝謝! –

+0

我會編輯我的帖子。 –

+0

我一直在這一整天。如果有人可以在AIM或YAHOO上發送即時消息。 (xtremer360) –

回答

1

對於tablesorterPager插件代碼中的工作,我不得不添加分頁的形式自己。我改變了分頁格到這一點,從documentation複製:

<div id="pagination"> 
    <form> 
     <img src="../addons/pager/icons/first.png" class="first"/> 
     <img src="../addons/pager/icons/prev.png" class="prev"/> 
     <input type="text" class="pagedisplay"/> 
     <img src="../addons/pager/icons/next.png" class="next"/> 
     <img src="../addons/pager/icons/last.png" class="last"/> 
     <select class="pagesize"> 
      <option selected="selected" value="10">10</option> 
      <option value="20">20</option> 
      <option value="30">30</option> 
      <option value="40">40</option> 
     </select> 
    </form> 
</div> 

的tablesorterPager現在的作品,同時也解決了在tablesorterPager找不到形式打破了的tablesorter。

我看不到jquery.tablesorter.pager.js中的任何引用來生成表單本身,所以我想你將不得不基於表中結果的數量來創建它,您希望每頁的結果數量。

希望幫助

+0

唯一的問題是我需要鏈接出現像這樣。

+0

啊我看到了,完全不同的問題;) – Tak

+0

我說,因爲它是存在於這裏的模板的一部分:kansasoutlawwrestling.com/manager/index2.html –