]>
Commit | Line | Data |
---|---|---|
31f18b77 FG |
1 | <!DOCTYPE html> |
2 | <html> | |
3 | <head> | |
4 | <meta charset="utf-8"> | |
5 | <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico"> | |
6 | <meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0"> | |
7 | ||
8 | <title>TableTools example - Ajax loaded data</title> | |
9 | <link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css"> | |
10 | <link rel="stylesheet" type="text/css" href="../css/dataTables.tableTools.css"> | |
11 | <link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css"> | |
12 | <link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css"> | |
13 | <style type="text/css" class="init"> | |
14 | ||
15 | </style> | |
16 | <script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script> | |
17 | <script type="text/javascript" language="javascript" src="../../../media/js/jquery.dataTables.js"></script> | |
18 | <script type="text/javascript" language="javascript" src="../js/dataTables.tableTools.js"></script> | |
19 | <script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script> | |
20 | <script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script> | |
21 | <script type="text/javascript" language="javascript" class="init"> | |
22 | ||
23 | ||
24 | $(document).ready(function() { | |
25 | $('#example').DataTable( { | |
26 | dom: 'T<"clear">lfrtip', | |
27 | "ajax": "../../../../examples/ajax/data/objects.txt", | |
28 | "columns": [ | |
29 | { "data": "name" }, | |
30 | { "data": "position" }, | |
31 | { "data": "office" }, | |
32 | { "data": "extn" }, | |
33 | { "data": "start_date" }, | |
34 | { "data": "salary" } | |
35 | ], | |
36 | deferRender: true | |
37 | } ); | |
38 | } ); | |
39 | ||
40 | ||
41 | </script> | |
42 | </head> | |
43 | ||
44 | <body class="dt-example"> | |
45 | <div class="container"> | |
46 | <section> | |
47 | <h1>TableTools example <span>Ajax loaded data</span></h1> | |
48 | ||
49 | <div class="info"> | |
50 | <p>This TableTools example shows DataTables using its ability to <a href="//datatables.net/manual/data#Objects">Ajax load object based data</a> and operate in | |
51 | exactly the same manner as when the data is read directly from the document.</p> | |
52 | </div> | |
53 | ||
54 | <table id="example" class="display" cellspacing="0" width="100%"> | |
55 | <thead> | |
56 | <tr> | |
57 | <th>Name</th> | |
58 | <th>Position</th> | |
59 | <th>Office</th> | |
60 | <th>Extn.</th> | |
61 | <th>Start date</th> | |
62 | <th>Salary</th> | |
63 | </tr> | |
64 | </thead> | |
65 | ||
66 | <tfoot> | |
67 | <tr> | |
68 | <th>Name</th> | |
69 | <th>Position</th> | |
70 | <th>Office</th> | |
71 | <th>Extn.</th> | |
72 | <th>Start date</th> | |
73 | <th>Salary</th> | |
74 | </tr> | |
75 | </tfoot> | |
76 | </table> | |
77 | ||
78 | <ul class="tabs"> | |
79 | <li class="active">Javascript</li> | |
80 | <li>HTML</li> | |
81 | <li>CSS</li> | |
82 | <li>Ajax</li> | |
83 | <li>Server-side script</li> | |
84 | </ul> | |
85 | ||
86 | <div class="tabs"> | |
87 | <div class="js"> | |
88 | <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() { | |
89 | $('#example').DataTable( { | |
90 | dom: 'T<"clear">lfrtip', | |
91 | "ajax": "../../../../examples/ajax/data/objects.txt", | |
92 | "columns": [ | |
93 | { "data": "name" }, | |
94 | { "data": "position" }, | |
95 | { "data": "office" }, | |
96 | { "data": "extn" }, | |
97 | { "data": "start_date" }, | |
98 | { "data": "salary" } | |
99 | ], | |
100 | deferRender: true | |
101 | } ); | |
102 | } );</code> | |
103 | ||
104 | <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p> | |
105 | ||
106 | <ul> | |
107 | <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li> | |
108 | <li><a href="../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li> | |
109 | <li><a href="../js/dataTables.tableTools.js">../js/dataTables.tableTools.js</a></li> | |
110 | </ul> | |
111 | </div> | |
112 | ||
113 | <div class="table"> | |
114 | <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p> | |
115 | </div> | |
116 | ||
117 | <div class="css"> | |
118 | <div> | |
119 | <p>This example uses a little bit of additional CSS beyond what is loaded from the library files (below), in order to correctly display the table. The | |
120 | additional CSS used is shown below:</p><code class="multiline language-css"></code> | |
121 | </div> | |
122 | ||
123 | <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p> | |
124 | ||
125 | <ul> | |
126 | <li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li> | |
127 | <li><a href="../css/dataTables.tableTools.css">../css/dataTables.tableTools.css</a></li> | |
128 | </ul> | |
129 | </div> | |
130 | ||
131 | <div class="ajax"> | |
132 | <p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data will update automatically as any additional data is | |
133 | loaded.</p> | |
134 | </div> | |
135 | ||
136 | <div class="php"> | |
137 | <p>The script used to perform the server-side processing for this table is shown below. Please note that this is just an example script using PHP. Server-side | |
138 | processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables | |
139 | documentation</a>.</p> | |
140 | </div> | |
141 | </div> | |
142 | </section> | |
143 | </div> | |
144 | ||
145 | <section> | |
146 | <div class="footer"> | |
147 | <div class="gradient"></div> | |
148 | ||
149 | <div class="liner"> | |
150 | <h2>Other examples</h2> | |
151 | ||
152 | <div class="toc"> | |
153 | <div class="toc-group"> | |
154 | <h3><a href="./index.html">Examples</a></h3> | |
155 | <ul class="toc active"> | |
156 | <li><a href="./simple.html">Basic initialisation</a></li> | |
157 | <li><a href="./swf_path.html">Setting the SWF path</a></li> | |
158 | <li><a href="./new_init.html">Initialisation with `new`</a></li> | |
159 | <li><a href="./defaults.html">Defaults</a></li> | |
160 | <li><a href="./select_single.html">Row selection - single row select</a></li> | |
161 | <li><a href="./select_multi.html">Row selection - multi-row select</a></li> | |
162 | <li><a href="./select_os.html">Row selection - operating system style</a></li> | |
163 | <li><a href="./select_column.html">Row selection - row selector on specific cells</a></li> | |
164 | <li><a href="./multiple_tables.html">Multiple tables</a></li> | |
165 | <li><a href="./multi_instance.html">Multiple toolbars</a></li> | |
166 | <li><a href="./collection.html">Button collections</a></li> | |
167 | <li><a href="./plug-in.html">Plug-in button types</a></li> | |
168 | <li><a href="./button_text.html">Custom button text</a></li> | |
169 | <li><a href="./alter_buttons.html">Button arrangement</a></li> | |
170 | <li class="active"><a href="./ajax.html">Ajax loaded data</a></li> | |
171 | <li><a href="./pdf_message.html">PDF message</a></li> | |
172 | <li><a href="./bootstrap.html">Bootstrap styling</a></li> | |
173 | <li><a href="./jqueryui.html">jQuery UI styling</a></li> | |
174 | </ul> | |
175 | </div> | |
176 | </div> | |
177 | ||
178 | <div class="epilogue"> | |
179 | <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br> | |
180 | Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and <a href="http://www.datatables.net/plug-ins">plug-ins</a> | |
181 | which extend the capabilities of DataTables.</p> | |
182 | ||
183 | <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2015<br> | |
184 | DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p> | |
185 | </div> | |
186 | </div> | |
187 | </div> | |
188 | </section> | |
189 | </body> | |
190 | </html> |