]>
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>ColVis example - Two tables with individual controls</title> | |
9 | <link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css"> | |
10 | <link rel="stylesheet" type="text/css" href="../css/dataTables.colVis.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.colVis.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 | $('table.display').DataTable( { | |
26 | dom: 'C<"clear">lfrtip', | |
27 | displayLength: 5 | |
28 | } ); | |
29 | } ); | |
30 | ||
31 | ||
32 | </script> | |
33 | </head> | |
34 | ||
35 | <body class="dt-example"> | |
36 | <div class="container"> | |
37 | <section> | |
38 | <h1>ColVis example <span>Two tables with individual controls</span></h1> | |
39 | ||
40 | <div class="info"> | |
41 | <p>It can be useful to have DataTables initialise more than one table with a single call can for them to each have individual ColVis controllers. All this requires | |
42 | is a suitable jQuery selector to be used, and DataTables and ColVis will take care of the rest - as shown in this example.</p> | |
43 | </div> | |
44 | ||
45 | <table id="" class="display" cellspacing="0" width="100%"> | |
46 | <thead> | |
47 | <tr> | |
48 | <th>Name</th> | |
49 | <th>Position</th> | |
50 | <th>Office</th> | |
51 | <th>Age</th> | |
52 | <th>Salary</th> | |
53 | </tr> | |
54 | </thead> | |
55 | ||
56 | <tfoot> | |
57 | <tr> | |
58 | <th>Name</th> | |
59 | <th>Position</th> | |
60 | <th>Office</th> | |
61 | <th>Age</th> | |
62 | <th>Salary</th> | |
63 | </tr> | |
64 | </tfoot> | |
65 | ||
66 | <tbody> | |
67 | <tr> | |
68 | <td>Tiger Nixon</td> | |
69 | <td>System Architect</td> | |
70 | <td>Edinburgh</td> | |
71 | <td>61</td> | |
72 | <td>$320,800</td> | |
73 | </tr> | |
74 | <tr> | |
75 | <td>Cedric Kelly</td> | |
76 | <td>Senior Javascript Developer</td> | |
77 | <td>Edinburgh</td> | |
78 | <td>22</td> | |
79 | <td>$433,060</td> | |
80 | </tr> | |
81 | <tr> | |
82 | <td>Sonya Frost</td> | |
83 | <td>Software Engineer</td> | |
84 | <td>Edinburgh</td> | |
85 | <td>23</td> | |
86 | <td>$103,600</td> | |
87 | </tr> | |
88 | <tr> | |
89 | <td>Quinn Flynn</td> | |
90 | <td>Support Lead</td> | |
91 | <td>Edinburgh</td> | |
92 | <td>22</td> | |
93 | <td>$342,000</td> | |
94 | </tr> | |
95 | <tr> | |
96 | <td>Dai Rios</td> | |
97 | <td>Personnel Lead</td> | |
98 | <td>Edinburgh</td> | |
99 | <td>35</td> | |
100 | <td>$217,500</td> | |
101 | </tr> | |
102 | <tr> | |
103 | <td>Gavin Joyce</td> | |
104 | <td>Developer</td> | |
105 | <td>Edinburgh</td> | |
106 | <td>42</td> | |
107 | <td>$92,575</td> | |
108 | </tr> | |
109 | <tr> | |
110 | <td>Martena Mccray</td> | |
111 | <td>Post-Sales support</td> | |
112 | <td>Edinburgh</td> | |
113 | <td>46</td> | |
114 | <td>$324,050</td> | |
115 | </tr> | |
116 | <tr> | |
117 | <td>Jennifer Acosta</td> | |
118 | <td>Junior Javascript Developer</td> | |
119 | <td>Edinburgh</td> | |
120 | <td>43</td> | |
121 | <td>$75,650</td> | |
122 | </tr> | |
123 | <tr> | |
124 | <td>Shad Decker</td> | |
125 | <td>Regional Director</td> | |
126 | <td>Edinburgh</td> | |
127 | <td>51</td> | |
128 | <td>$183,000</td> | |
129 | </tr> | |
130 | </tbody> | |
131 | </table> | |
132 | ||
133 | <table id="" class="display" cellspacing="0" width="100%"> | |
134 | <thead> | |
135 | <tr> | |
136 | <th>Name</th> | |
137 | <th>Position</th> | |
138 | <th>Office</th> | |
139 | <th>Age</th> | |
140 | <th>Salary</th> | |
141 | </tr> | |
142 | </thead> | |
143 | ||
144 | <tfoot> | |
145 | <tr> | |
146 | <th>Name</th> | |
147 | <th>Position</th> | |
148 | <th>Office</th> | |
149 | <th>Age</th> | |
150 | <th>Salary</th> | |
151 | </tr> | |
152 | </tfoot> | |
153 | ||
154 | <tbody> | |
155 | <tr> | |
156 | <td>Jena Gaines</td> | |
157 | <td>Office Manager</td> | |
158 | <td>London</td> | |
159 | <td>30</td> | |
160 | <td>$90,560</td> | |
161 | </tr> | |
162 | <tr> | |
163 | <td>Haley Kennedy</td> | |
164 | <td>Senior Marketing Designer</td> | |
165 | <td>London</td> | |
166 | <td>43</td> | |
167 | <td>$313,500</td> | |
168 | </tr> | |
169 | <tr> | |
170 | <td>Tatyana Fitzpatrick</td> | |
171 | <td>Regional Director</td> | |
172 | <td>London</td> | |
173 | <td>19</td> | |
174 | <td>$385,750</td> | |
175 | </tr> | |
176 | <tr> | |
177 | <td>Michael Silva</td> | |
178 | <td>Marketing Designer</td> | |
179 | <td>London</td> | |
180 | <td>66</td> | |
181 | <td>$198,500</td> | |
182 | </tr> | |
183 | <tr> | |
184 | <td>Bradley Greer</td> | |
185 | <td>Software Engineer</td> | |
186 | <td>London</td> | |
187 | <td>41</td> | |
188 | <td>$132,000</td> | |
189 | </tr> | |
190 | <tr> | |
191 | <td>Angelica Ramos</td> | |
192 | <td>Chief Executive Officer (CEO)</td> | |
193 | <td>London</td> | |
194 | <td>47</td> | |
195 | <td>$1,200,000</td> | |
196 | </tr> | |
197 | <tr> | |
198 | <td>Suki Burks</td> | |
199 | <td>Developer</td> | |
200 | <td>London</td> | |
201 | <td>53</td> | |
202 | <td>$114,500</td> | |
203 | </tr> | |
204 | <tr> | |
205 | <td>Prescott Bartlett</td> | |
206 | <td>Technical Author</td> | |
207 | <td>London</td> | |
208 | <td>27</td> | |
209 | <td>$145,000</td> | |
210 | </tr> | |
211 | <tr> | |
212 | <td>Timothy Mooney</td> | |
213 | <td>Office Manager</td> | |
214 | <td>London</td> | |
215 | <td>37</td> | |
216 | <td>$136,200</td> | |
217 | </tr> | |
218 | <tr> | |
219 | <td>Bruno Nash</td> | |
220 | <td>Software Engineer</td> | |
221 | <td>London</td> | |
222 | <td>38</td> | |
223 | <td>$163,500</td> | |
224 | </tr> | |
225 | <tr> | |
226 | <td>Hermione Butler</td> | |
227 | <td>Regional Director</td> | |
228 | <td>London</td> | |
229 | <td>47</td> | |
230 | <td>$356,250</td> | |
231 | </tr> | |
232 | <tr> | |
233 | <td>Lael Greer</td> | |
234 | <td>Systems Administrator</td> | |
235 | <td>London</td> | |
236 | <td>21</td> | |
237 | <td>$103,500</td> | |
238 | </tr> | |
239 | </tbody> | |
240 | </table> | |
241 | ||
242 | <ul class="tabs"> | |
243 | <li class="active">Javascript</li> | |
244 | <li>HTML</li> | |
245 | <li>CSS</li> | |
246 | <li>Ajax</li> | |
247 | <li>Server-side script</li> | |
248 | </ul> | |
249 | ||
250 | <div class="tabs"> | |
251 | <div class="js"> | |
252 | <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() { | |
253 | $('table.display').DataTable( { | |
254 | dom: 'C<"clear">lfrtip', | |
255 | displayLength: 5 | |
256 | } ); | |
257 | } );</code> | |
258 | ||
259 | <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p> | |
260 | ||
261 | <ul> | |
262 | <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li> | |
263 | <li><a href="../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li> | |
264 | <li><a href="../js/dataTables.colVis.js">../js/dataTables.colVis.js</a></li> | |
265 | </ul> | |
266 | </div> | |
267 | ||
268 | <div class="table"> | |
269 | <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p> | |
270 | </div> | |
271 | ||
272 | <div class="css"> | |
273 | <div> | |
274 | <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 | |
275 | additional CSS used is shown below:</p><code class="multiline language-css"></code> | |
276 | </div> | |
277 | ||
278 | <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p> | |
279 | ||
280 | <ul> | |
281 | <li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li> | |
282 | <li><a href="../css/dataTables.colVis.css">../css/dataTables.colVis.css</a></li> | |
283 | </ul> | |
284 | </div> | |
285 | ||
286 | <div class="ajax"> | |
287 | <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 | |
288 | loaded.</p> | |
289 | </div> | |
290 | ||
291 | <div class="php"> | |
292 | <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 | |
293 | processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables | |
294 | documentation</a>.</p> | |
295 | </div> | |
296 | </div> | |
297 | </section> | |
298 | </div> | |
299 | ||
300 | <section> | |
301 | <div class="footer"> | |
302 | <div class="gradient"></div> | |
303 | ||
304 | <div class="liner"> | |
305 | <h2>Other examples</h2> | |
306 | ||
307 | <div class="toc"> | |
308 | <div class="toc-group"> | |
309 | <h3><a href="./index.html">Examples</a></h3> | |
310 | <ul class="toc active"> | |
311 | <li><a href="./simple.html">Basic initialisation</a></li> | |
312 | <li><a href="./new_init.html">`new` initialisation</a></li> | |
313 | <li><a href="./text.html">Custom button text</a></li> | |
314 | <li><a href="./exclude_columns.html">Exclude columns from list</a></li> | |
315 | <li><a href="./title_callback.html">Column button callback</a></li> | |
316 | <li><a href="./button_order.html">Button ordering</a></li> | |
317 | <li><a href="./mouseover.html">Mouseover activation</a></li> | |
318 | <li><a href="./group_columns.html">Group columns</a></li> | |
319 | <li class="active"><a href="./two_tables.html">Two tables with individual controls</a></li> | |
320 | <li><a href="./two_tables_identical.html">Two tables with shared controls</a></li> | |
321 | <li><a href="./restore.html">Restore / show all</a></li> | |
322 | <li><a href="./jqueryui.html">jQuery UI styling</a></li> | |
323 | </ul> | |
324 | </div> | |
325 | </div> | |
326 | ||
327 | <div class="epilogue"> | |
328 | <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br> | |
329 | 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> | |
330 | which extend the capabilities of DataTables.</p> | |
331 | ||
332 | <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2015<br> | |
333 | DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p> | |
334 | </div> | |
335 | </div> | |
336 | </div> | |
337 | </section> | |
338 | </body> | |
339 | </html> |