Javascript Tablesorter不工作,已尝试现有解决方案

Javascript Tablesorter不工作,已尝试现有解决方案,javascript,jquery,html,css,tablesorter,Javascript,Jquery,Html,Css,Tablesorter,我在实现TableSorter2.0时遇到问题。我希望使用这个库对表进行排序,如果可能的话,使用小部件进行过滤。下面是我的代码 JavaScript:myinclude库 <%@page contentType="text/html" pageEncoding="UTF-8"%> <script type="text/javascript" src="javascripts/jquery-1.7.2.min.js"></script> <script t

我在实现TableSorter2.0时遇到问题。我希望使用这个库对表进行排序,如果可能的话,使用小部件进行过滤。下面是我的代码

JavaScript:myinclude库

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<script type="text/javascript" src="javascripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
    var j = jQuery.noConflict(true);
</script>
<script type="text/javascript" src="javascripts/jquery.tablesorter.min.js"></script>                
<script type="text/javascript" src="javascripts/jquery.tablesorter.widgets.js"></script>
<script type="text/javascript">
    j(document).ready(function () {
        j('#course_table').tablesorter({
                       widthFixed: true,
                       widgets: ['filter'],
                       ignoreCase: false
                });
        });
</script>

var j=jQuery.noConflict(true);
j(文件).准备就绪(功能(){
j(“#课程表”)。表排序器({
是的,
小部件:['filter'],
忽略情况:错误
});
});
HTML:我的表体完全是作为servlet中动态构建的字符串添加的,但这根本不起作用,所以我降级为在JSP中构建它

<table  class="tablesorter CourseSelector_table search-table" id="course_table" cellpadding="0" cellspacing="0">    
                        <thead>
                            <tr>
                                <th>Select</th>
                                <th title="Click to Sort by Course">Course</th>
                                <th title="Click to Sort by Course Title">Course Title</th>
                                <th title="Click to Sort by Credits">Credits</th>
                                <th title="Click to Sort by Effective Term">Effective Term</th>
                                <th title="Click to Sort by Goal 1">Goal 1</th>
                                <th title="Click to Sort by Goal 2">Goal 2</th>
                                <th title="Click to Sort by Goal 3">Goal 3</th>
                                <th title="Click to Sort by Goal 4">Goal 4</th>
                                <th title="Click to Sort by Goal 5">Goal 5</th>
                                <th title="Click to Sort by Goal 6">Goal 6</th>
                                <th title="Click to Sort by Goal 7">Goal 7</th>
                                <th title="Click to Sort by Goal 8">Goal 8</th>
                                <th title="Click to Sort by Goal 9">Goal 9</th>
                                <th title="Click to Sort by Goal 10">Goal 10</th>
                            </tr>
                        </thead>
                        <tbody>
                            <c:forEach items="${courses}" var="row">
                                <tr id="${row.courseID}" onclick="GETemplate.addCourse(${row.courseID});
                                        changeRow(this);">
                                    <td><input type = "checkbox" id="${row.courseSubject}${row.catalogNumber}"
                                               onchange="selectClassToAdd(this)" value="${row.courseID}"</td>
                                    <td><label for="${row.courseID}">
                                            ${row.courseSubject}
                                            <br>
                                            ${row.catalogNumber}
                                        </label></td>
                                    <td><label  for="${row.courseID}">${row.courseName}</label></td>
                                    <td>${row.credits}</td>
                                    <td><label id="${row.courseName}"/></td>
                                    <td>${row.points[1]}</td>
                                    <td>${row.points[2]}</td>
                                    <td>${row.points[3]}</td>
                                    <td>${row.points[4]}</td>
                                    <td>${row.points[5]}</td>
                                    <td>${row.points[6]}</td>
                                    <td>${row.points[7]}</td>
                                    <td>${row.points[8]}</td>
                                    <td>${row.points[9]}</td>
                                    <td>${row.points[10]}</td>                            
                                </tr>
                            <script>
                                var termName = "";
                                switch ('${row.effectiveTerm}' % 10) {
                                    case 2:
                                        termName = "Spring";
                                        break;
                                    case 4:
                                        termName = "Summer";
                                        break;
                                    case 6:
                                        termName = "Fall";
                                        break;
                                    case 8:
                                        termName = "Winter";
                                        break;
                                }
                                var term = Math.floor('${row.effectiveTerm}' / 10);
                                var year = 2000 + term % 100;
                                document.getElementById("${row.courseName}").innerHTML = termName + "<br>" + year;
                                document.getElementById("${row.courseID}").className = ("content" + " " + '${row.courseSubject}' + " " + termName + " " + year + " " + "obj_row_item");
                            </script>
                        </c:forEach>
                        <%--${courseSelectorTable}--%>
                        </tbody>
                    </table>

挑选
课程
课程名称
信用
有效期
目标1
目标2
目标3
目标4
目标5
目标6
目标7
目标8
目标9
目标10

我曾经使用过这个插件,但很快就放弃了它,换了一个,在我看来,这个插件更灵活、更健壮:tablesorter初始化时表是否存在?尝试添加
debug
选项以查看。。。如果它确实存在,那么在ajax成功函数中,触发一个“更新”-
$('table')。触发器('update')将内容添加到tbody后。如果不存在,则在该点初始化tablesorter。