【发布时间】:2014-07-12 05:58:36
【问题描述】:
您好,我正在使用 tablesorter Link .. 如果我包含“ page_my(_($help_context = "Table")); " --- 这是我的标题部分,我的分页将无法正常工作
header 部分:基本上包括 HTML 标签和 session 值 ...我教过因为我的 session 和 php 代码可能导致不运行分页,因此我删除了所有 php 和 session 代码..但它仍然无法正常工作......也没有其他JS文件包含在这个
下面是我的代码
<?php
$page_security = 'SA_TABLESORTER';
$path_to_root = "..";
include($path_to_root . "/includes/session.inc");
page_my(_($help_context = "Table"));
echo'
<link rel="stylesheet" href="table/style.css" type="text/css" media="print, projection, screen" />
<script src="table/jquery-latest.js"></script>
<script src="table/jquery.tablesorter.js"></script>
<script src="table/jquery.tablesorter.widgets.js"></script>
<script type="text/javascript" src="table/jquery.tablesorter.pager.js"></script>
<script type="text/javascript">
$(function() {
$("table").tablesorter({
widthFixed: true, widgets: ["zebra", "filter"],
headers: { 5: { sorter: false, filter: false } },
widgetOptions : {
filter_cssFilter : \'tablesorter-filter\',
filter_childRows : false,
filter_startsWith : false
}
})
.tablesorterPager({container: $("#pager")}) ;
});
</script>';
?>
<table id="myTable" class="tablesorter">
<thead>
<tr>
<th>Last Name</th>
<th>First Name</th>
<th>Email</th>
<th>Web Site</th>
</tr>
</thead>
<tbody>
<tr>
<td>Smith</td>
<td>John</td>
<td>jsmith@gmail.com</td>
<td>http://www.jsmith.com</td>
</tr>
<tr>
<td>Doe</td>
<td>Jason</td>
<td>jdoe@hotmail.com</td>
<td>http://www.jdoe.com</td>
</tr>
<tr>
<td>Student01</td>
<td>Languages</td>
<td>male</td>
<td>80</td>
</tr>
<tr>
<td>Student02</td>
<td>Mathematics</td>
<td>male</td>
<td>90</td>
</tr>
<tr>
<td>Smith2</td>
<td>John</td>
<td>jsmith@gmail.com</td>
<td>http://www.jsmith.com</td>
</tr>
<tr>
<td>Doe1q</td>
<td>Jason</td>
<td>jdoe@hotmail.com</td>
<td>http://www.jdoe.com</td>
</tr>
<tr>
<td>Student03</td>
<td>Languages3</td>
<td>male3</td>
<td>180</td>
</tr>
<tr>
<td>Student04</td>
<td>Mathematics4</td>
<td>male4</td>
<td>190</td>
</tr>
<tr>
<td>Student04</td>
<td>Mathematics4</td>
<td>male4</td>
<td>190</td>
</tr>
<tr>
<td>Student04</td>
<td>Mathematics4</td>
<td>male4</td>
<td>190</td>
</tr>
<tr>
<td>Student04</td>
<td>Mathematics4</td>
<td>male4</td>
<td>190</td>
</tr> <tr>
<td>Student04</td>
<td>Mathematics4</td>
<td>male4</td>
<td>190</td>
</tr> <tr>
<td>Student04</td>
<td>Mathematics4</td>
<td>male4</td>
<td>190</td>
</tr> <tr>
<td>Student04</td>
<td>Mathematics4</td>
<td>male4</td>
<td>190</td>
</tr> <tr>
<td>Student04</td>
<td>Mathematics4</td>
<td>male4</td>
<td>190</td>
</tr> <tr>
<td>Student04</td>
<td>Mathematics4</td>
<td>male4</td>
<td>190</td>
</tr>
</tbody>
</table>
<?php
echo"<div id=\"pager\" class=\"pager\">
<br \>
<form>
<img src=\"table/first.png\" class=\"first\"/>
<img src=\"table/prev.png\" class=\"prev\"/>
<input type=\"text\" class=\"pagedisplay\"/>
<img src=\"table//next.png\" class=\"next\"/>
<img src=\"table/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>";
?>
<?php
br(1);
end_page(); // footer section
?>
如果我删除“page_my(_($help_context = "Table"));” - 这个函数然后我的分页工作正常但是如果我包含这个函数(我的标题部分)然后我得到 错误萤火虫
TypeError: c 未定义
c.page++;在“jquery.tablesorter.pager.js”的链接 46 处
这是:
function moveToNextPage(table) {
var c = table.config;
c.page++;
if(c.page >= (c.totalPages-1)) {
c.page = (c.totalPages-1);
}
moveToPage(table);
}
【问题讨论】:
-
错误意味着table.config变量中没有属性'page'..你为什么不使用更好的表格排序插件,比如datatables.net?
-
嘿Bhavesh,谢谢你的回复..老兄,但正如我所说..当我删除“page_my(_($help_context = "Table"));”然后也可以正常工作..这个功能有我所有的 HEADER SECTION 内容
-
bhavesh : +1 数据表链接.. 谢谢
-
这里的任何人......仍在等待答案
标签: javascript jquery pagination tablesorter