您好我正在使用tablesorter Link ..如果我包含“page_my(_($ help_context =”Table“)),我的分页无法正常工作;”---这是我的标题部分
标题部分:基本上包含HTML标记和会话值 ...我教过因为我的会话和PHP代码可能导致不运行分页,因此我删除了所有的PHP和会话代码..但它仍然不起作用......此
中没有其他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);
}
答案 0 :(得分:0)
我不得不怀疑你使用的是什么版本的tablesorter。您共享的链接是原始tablesorter v2.0.5b。
过滤器小部件是我的fork of tablesorter的一部分,它需要从GitHub下载的插件和寻呼机的版本。您似乎正在使用正确的文件,但请验证版本号。该分叉目前为2.17.4。
编辑:实际上,您分享的寻呼机代码看起来并不像当前代码那样:
moveToNextPage = function(table, p) {
p.page++;
if ( p.page >= ( Math.min( p.totalPages, p.filteredPages ) - 1 ) ) {
p.page = ( Math.min( p.totalPages, p.filteredPages ) - 1 );
}
moveToPage(table, p);
}