如果这是一个重复的问题,我很抱歉,但我花了几个小时寻找解决方案而没有成功。也很抱歉英语不好,不是我的母语。:(
这是我的问题:
我有一个由Spring 3.0.5处理的 Web 应用程序。我的一个JSP文件从数据库中检索数据并将其放入表中,这很好。我正在尝试使用 jquery 插件tablesort对表中的字段进行排序,这对我来说也很好,所以我尝试使用寻呼机插件,这就是我的童话故事落下的时候。
正如tablesorter web 中的文档所说,我在表格末尾定义了一个带有“id = anyname”的表格,并在脚本中调用它,但它不起作用。
我在这里留下了我的 JSP 文件:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/style.css"/>" />
<link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/jquery.tablesorter.pager.css"/>" />
<script type="text/javascript" src="<c:url value="/resources/js/jquery-1.8.2.js" />"></script>
<script type="text/javascript" src="<c:url value="/resources/js/jquery-ui-1.9.1.custom.js" />"></script>
<script type="text/javascript" src="<c:url value="/resources/js/jquery-ui-1.9.1.custom.min.js" />"></script>
<script type="text/javascript" src="<c:url value="/resources/js/jquery.tablesorter.pager.js" />"></script>
<script type="text/javascript" src="<c:url value="/resources/js/jquery.tablesorter.js" />"></script>
<script>
$(document).ready(function() {
$("#consulta")
.tablesorter({
headers: { 0: { sorter: false }, 1: { sorter: false }, 6: { sorter: false }},
sortList: [[2, 0], [0, 0]],
widthFixed: true,
widgets: ['zebra']})
.tablesorterPager({container: $("#pager")});
});
</script>
</head>
<body>
/*
*
*
*
*/
<table id="consulta" class="tablesorter">
<thead>
<tr>
<th>Código</th>
<th>Especialidad</th>
<th>Asunto</th>
<th>Fecha</th>
<th>Ciclo</th>
<th>Estado</th>
<th>Opciones</th>
</tr>
</thead>
<tbody>
<c:forEach items="${consultaSol}" var="solic">
<c:url var="verUrl" value="/manage/mgmtSol/detalle?id=${solic.id}" />
<tr>
<td><c:out value="${solic.codigo}" /></td>
<td><c:out value="${solic.especialidad}" /></td>
<td><c:out value="${solic.asunto}" /></td>
<td><c:out value="${solic.fecha}" /></td>
<td><c:out value="${solic.ciclo}" /></td>
<c:if test="${solic.estado == 0 }">
<td>No atendido</td>
</c:if>
<c:if test="${solic.estado == 1 }">
<td>Atendido</td>
</c:if>
<c:if test="${solic.estado == 2 }">
<td>Resuelto</td>
</c:if>
<td><a href="${verUrl}">Ver Detalle</a></td>
</tr>
</c:forEach>
</tbody>
</table>
<div id="pager" class="pager">
<form>
<img src="<c:url value="/resources/imagenes/first.png" />" class="first"/>
<img src="<c:url value="/resources/imagenes/prev.png" />" class="prev"/>
<input type="text" class="pagedisplay" readonly="readonly"/>
<img src="<c:url value="/resources/imagenes/next.png" />" class="next"/>
<img src="<c:url value="/resources/imagenes/last.png" />" class="last"/>
<select class="pagesize">
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
</select>
</form>
</div>
</body>
</html>
我不知道我做错了什么,正如 ai 在 tablesort 工作正常但寻呼机选项没有之前所说的那样。顺便说一句,我使用的是 jquery 1.9.1 并将其更改为 1.8.2 版本,但它不起作用。
此外,当我运行该应用程序时,Chrome 开发人员工具显示一个错误:
Uncaught TypeError: Cannot call method 'addClass' of undefined
但我不明白,它来自 jquery-1.8.2.js 文件。
请帮帮我!
提前致谢。