Thu Jan 10, 2013 3:18 pm
<html>
<head>
<title>Sort table using JQuery</title>
<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>
<script type='text/javascript' src='jquery-latest.js'></script>
<script type='text/javascript' src='jquery.tablesorter.js'></script>
<script>
$(document).ready(function()
{
$("#studentsTable").tablesorter();
}
);
</script>
</head>
<body>
<table id="studentsTable" class="tablesorter" border="1px">
<thead>
<tr>
<th>ID</th>
<th>Student Name</th>
<th>Department</th>
<th>Class</th>
<th>GPA</th>
</tr>
</thead>
<tbody>
<tr>
<td>323</td>
<td>Smith</td>
<td>Computer Science</td>
<td>A1</td>
<td>3.4</td>
</tr>
<tr>
<td>345</td>
<td>Johan</td>
<td>Computer Science</td>
<td>A1</td>
<td>2.7</td>
</tr>
<tr>
<td>21</td>
<td>Ali</td>
<td>Electric Engineering</td>
<td>EE4</td>
<td>3.0</td>
</tr>
<tr>
<td>33</td>
<td>Tonson</td>
<td>Electric Engineering</td>
<td>EE4</td>
<td>3.2</td>
</tr>
</tbody>
</table>
</body>
</html>
<script>
$(document).ready(function()
{
$("#studentsTable").tablesorter({
headers: {2: {sorter: false},4: {sorter: false}
}
});
}
);
</script>
<script>
$(document).ready(function()
{
$("#studentsTable").tablesorter({
// fourth column and i ascending order.
sortList: [[3,1]]
});
}
);
</script>
<script type='text/javascript' src='jquery-latest.js'></script>
<script type='text/javascript' src='jquery.tablesorter.js'></script>
http://tablesorter.com
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.