Tablesorter : TypeError: c is undefined :::: c.page++;

Tablesorter : TypeError: c is undefined :::: c.page++;

本文关键字:page++ undefined is Tablesorter TypeError      更新时间:2023-09-26

你好,我使用的是tableorter Link ..和我的分页不工作,如果我包括"page_my(_($help_context ="表"));——这是我的标题部分

header部分:基本上包括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"));-这个函数然后我的分页工作正常,但如果我包括这个函数(我的头节),然后我得到错误在firebug

TypeError: c is undefined

c.page + +;在" jquery.tablesorter.page .js "的第46个链接

function moveToNextPage(table) { 
            var c = table.config;
            c.page++;
            if(c.page >= (c.totalPages-1)) {
                c.page = (c.totalPages-1);
            }
            moveToPage(table);
}

我想知道你使用的是什么版本的表排序器。您所共享的链接指向原始的表排序程序v2.0.5b。

过滤器小部件是我的fork的一部分,它需要从GitHub下载的插件和pager的版本。看起来您正在使用正确的文件,但请验证版本号。当前版本为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);
}