-
Notifications
You must be signed in to change notification settings - Fork 1
/
jQsimpleXmpl.html
executable file
·87 lines (76 loc) · 2.22 KB
/
jQsimpleXmpl.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Simple jQuery-DataTable Example</title>
<link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico" />
<title>Simple jQuery-DataTable Example</title>
<style type="text/css" title="currentStyle">
@import "/css/demo_page.css";
@import "/css/demo_table.css";
</style>
<script type="text/javascript" language="javascript" src="/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
/* Global var for counter */
var giCount = 1;
$(document).ready(function() {
$('#example').dataTable();
} );
function fnClickAddRow() {
$('#example').dataTable().fnAddData( [
giCount+".1",
giCount+".2",
giCount+".3",
giCount+".4" ] );
giCount++;
}
</script>
</head>
</head>
<body id="dt_example">
<div id="container">
<div class="full_width big">
<i>DataTables</i> add row example
</div>
<h1>Preamble</h1>
<p><i>DataTables</i> adding rows in DataTables is done by assigning the DataTables jQuery object to a variable when initialising it, and then using it's API methods to add a new row. Deleting rows can be done in a similar manner.</p>
<h1>Live example</h1>
<p><a href="javascript:void(0);" onclick="fnClickAddRow();">Click to add a new row</a></p>
<div id="demo">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
<th>Column 4</th>
</tr>
</thead>
<tbody>
<tr>
<td>allan</td>
<td>allan</td>
<td>allan</td>
<td>allan</td>
</tr>
</tbody>
</table>
</div>
<div class="spacer"></div>
<h1>Initialisation code</h1>
<pre>/* Global var for counter */
var giCount = 1;
$(document).ready(function() {
$('#example').dataTable();
} );
function fnClickAddRow() {
$('#example').dataTable().fnAddData( [
giCount+".1",
giCount+".2",
giCount+".3",
giCount+".4" ] );
giCount++;
}</pre>
</div>
</body>
</html>