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">
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">
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">
24 $(document).ready(function() {
25 $('table.display').DataTable( {
26 dom: 'C<
"clear">lfrtip',
35 <body class=
"dt-example">
36 <div class=
"container">
38 <h1>ColVis example
<span>Two tables with individual controls
</span></h1>
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>
45 <table id=
"" class=
"display" cellspacing=
"0" width=
"100%">
69 <td>System Architect
</td>
76 <td>Senior Javascript Developer
</td>
83 <td>Software Engineer
</td>
97 <td>Personnel Lead
</td>
110 <td>Martena Mccray
</td>
111 <td>Post-Sales support
</td>
117 <td>Jennifer Acosta
</td>
118 <td>Junior Javascript Developer
</td>
125 <td>Regional Director
</td>
133 <table id=
"" class=
"display" cellspacing=
"0" width=
"100%">
157 <td>Office Manager
</td>
163 <td>Haley Kennedy
</td>
164 <td>Senior Marketing Designer
</td>
170 <td>Tatyana Fitzpatrick
</td>
171 <td>Regional Director
</td>
177 <td>Michael Silva
</td>
178 <td>Marketing Designer
</td>
184 <td>Bradley Greer
</td>
185 <td>Software Engineer
</td>
191 <td>Angelica Ramos
</td>
192 <td>Chief Executive Officer (CEO)
</td>
205 <td>Prescott Bartlett
</td>
206 <td>Technical Author
</td>
212 <td>Timothy Mooney
</td>
213 <td>Office Manager
</td>
220 <td>Software Engineer
</td>
226 <td>Hermione Butler
</td>
227 <td>Regional Director
</td>
234 <td>Systems Administrator
</td>
243 <li class=
"active">Javascript
</li>
247 <li>Server-side script
</li>
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',
259 <p>In addition to the above code, the following Javascript library files are loaded for use in this example:
</p>
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>
269 <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:
</p>
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>
278 <p>The following CSS library files are loaded for use in this example to provide the styling of the table:
</p>
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>
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
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>
302 <div class=
"gradient"></div>
305 <h2>Other examples
</h2>
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>
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>
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>