我正在尝试对jsp中的表进行排序。我使用了一个名为tableSorter的jquery插件来对我的表进行排序,但我运气不好。这是我的密码。我不确定我在哪里错过了东西。我正在从MYSQL数据库填充此表。
这是我的表排序函数,我正在使用它对jsp中的表进行排序。
<script type="text/javascript" src="js/jquery-ui-min.js"></script>
<script type="text/javascript" src="js/jquery.tinysort.min.js"></script>
var aAsc = [];
function sortTable(nr) {
aAsc[nr] = aAsc[nr]=='asc'?'desc':'asc';
$('#records>tbody>tr').tsort('td:eq('+nr+')[abbr]',{order:aAsc[nr]});
}
<table ID="records" class="results" border="1" cellspacing="0">
<thead>
<tr>
<th><a href="javascript:sortTable(0)" style=" color: #ffffff; text-decoration: underline; ">ID</a></th>
<th>Name</th>
<th>Date</th>
</tr>
</thead>
<logic:notEmpty property="results" name="finalResults" scope="page">
<logic:iterate id="i" indexId="count" property="results" name="finalResults" scope="page">
<%-- Logic for formatting the data from DB goes here--%>
</logic:iterate>
</logic:notEmpty>
我在这里使用href对我的数据进行排序。但是href在我点击它时什么都不做。我遗漏了什么吗?
类应该是表分类器
类似:table ID="records"class="tablesorter"border="1"cellspacing="0"
试试这个::
我举了一个例子,请看这个链接,在这里我使用_jquery.tablesorter.min.js
让我知道这是否有帮助。tableSorter示例