1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
5
<title>jQuery plugin: Tablesorter 2.0 - Appending table data with ajax</title>
6
<link rel="stylesheet" href="css/jq.css" type="text/css" media="print, projection, screen" />
7
<link rel="stylesheet" href="../themes/blue/style.css" type="text/css" id="" media="print, projection, screen" />
8
<script type="text/javascript" src="../jquery-latest.js"></script>
9
<script type="text/javascript" src="../jquery.tablesorter.js"></script>
10
<script type="text/javascript" src="js/chili/chili-1.8b.js"></script>
11
<script type="text/javascript" src="js/docs.js"></script>
12
<script type="text/javascript" src="js/examples.js"></script>
13
<script type="text/javascript" id="js">
14
$(document).ready(function() {
15
$("table").tablesorter();
16
$("#ajax-append").click(function() {
17
$.get("assets/ajax-content.html", function(html) {
18
// append the "ajax'd" data to the table body
19
$("table tbody").append(html);
20
// let the plugin know that we made a update
21
$("table").trigger("update");
22
// set sorting column and direction, this will sort on the first and third column
23
var sorting = [[2,1],[0,0]];
24
// sort on the first column
25
$("table").trigger("sorton",[sorting]);
34
<h1>table<em>sorter</em></h1>
35
<h2>Appending table data with ajax</h2>
36
<h3>Flexible client-side table sorting</h3>
37
<a href="index.html">Back to documentation</a>
42
<table cellspacing="1" class="tablesorter">
62
<td>Jul 6, 2006 8:14 AM</td>
71
<td>Dec 10, 2002 5:14 AM</td>
79
<td>Jan 12, 2003 11:14 AM</td>
88
<td>Jan 18, 2001 9:12 AM</td>
96
<td>Jan 18, 2007 9:12 AM</td>
100
<a href="#" id="ajax-append">Append new table data</a>
105
<div id="javascript">
106
<pre class="javascript"></pre>
110
<pre class="html"></pre>
113
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
114
<script type="text/javascript">
115
_uacct = "UA-2189649-2";