You need to download table sorter plugin and add reference to your project.. it may work perfect..
Jquery basic Table Sorter not working
-
09-10-2022 - |
سؤال
This is really basic table sorting code... Does this work for you ? I can't figure why it's not working on my machine (Chrome or IE). I took that from Tablesorter example not working but I did close my "script" tag though.
<head>
<title>Test</title>
<script src="http://tablesorter.com/jquery-latest.js" type="text/javascript"></script>
<script src="http://tablesorter.com/jquery.tablesorter.min.js" type="text/javascript">
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#tablesorter-demo").tablesorter();
});
</script>
</head>
<body>
<table id="tablesorter-demo" class="tablesorter" border="2" cellpadding="0" cellspacing="1">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Age</th>
<th>Total</th>
<th>Discount</th>
<th>Difference</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>Peter</td>
<td>Parker</td>
<td>28</td>
<td>$9.99</td>
<td>20.9%</td>
<td>+12.1</td>
<td>Jul 6, 2006 8:14 AM</td>
</tr>
<tr>
<td>John</td>
<td>Hood</td>
<td>33</td>
<td>$19.99</td>
<td>25%</td>
<td>+12</td>
<td>Dec 10, 2002 5:14 AM</td>
</tr>
<tr>
<td>Clark</td>
<td>Kent</td>
<td>18</td>
<td>$15.89</td>
<td>44%</td>
<td>-26</td>
<td>Jan 12, 2003 11:14 AM</td>
</tr>
</tbody>
</table>
</body>
المحلول
لا تنتمي إلى StackOverflow