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 - `new` initialisation</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 var table = $('#example').DataTable();
26 var colvis = new $.fn.dataTable.ColVis( table );
28 $( colvis.button() ).insertAfter('div.info');
35 <body class="dt-example">
36 <div class="container">
38 <h1>ColVis example <span>`new` initialisation</span></h1>
41 <p>As well as providing the option to be initialised through the <code>C</code> option of <a href="//datatables.net/reference/option/dom"><code class="option"
42 title="DataTables initialisation option">dom<span>DT</span></code></a>, ColVis can also be added to a DataTable using direct initialisation - <code>new
43 $.fn.dataTable.ColVis();</code> as shown in this example. The ColVis control button it available through its <code>button()</code> method, which can then be used
44 to attach to the document where you need.</p>
46 <p>For full information about the ColVis API, please refer to the <a href="//datatables.net/extensions/colvis/api">ColVis API documentation</a>.</p>
49 <table id="example" class="display" cellspacing="0" width="100%">
75 <td>System Architect</td>
82 <td>Garrett Winters</td>
91 <td>Junior Technical Author</td>
92 <td>San Francisco</td>
99 <td>Senior Javascript Developer</td>
114 <td>Brielle Williamson</td>
115 <td>Integration Specialist</td>
122 <td>Herrod Chandler</td>
123 <td>Sales Assistant</td>
124 <td>San Francisco</td>
130 <td>Rhona Davidson</td>
131 <td>Integration Specialist</td>
138 <td>Colleen Hurst</td>
139 <td>Javascript Developer</td>
140 <td>San Francisco</td>
147 <td>Software Engineer</td>
155 <td>Office Manager</td>
163 <td>Support Lead</td>
170 <td>Charde Marshall</td>
171 <td>Regional Director</td>
172 <td>San Francisco</td>
178 <td>Haley Kennedy</td>
179 <td>Senior Marketing Designer</td>
186 <td>Tatyana Fitzpatrick</td>
187 <td>Regional Director</td>
194 <td>Michael Silva</td>
195 <td>Marketing Designer</td>
203 <td>Chief Financial Officer (CFO)</td>
210 <td>Gloria Little</td>
211 <td>Systems Administrator</td>
218 <td>Bradley Greer</td>
219 <td>Software Engineer</td>
227 <td>Personnel Lead</td>
234 <td>Jenette Caldwell</td>
235 <td>Development Lead</td>
243 <td>Chief Marketing Officer (CMO)</td>
250 <td>Caesar Vance</td>
251 <td>Pre-Sales Support</td>
258 <td>Doris Wilder</td>
259 <td>Sales Assistant</td>
266 <td>Angelica Ramos</td>
267 <td>Chief Executive Officer (CEO)</td>
282 <td>Jennifer Chang</td>
283 <td>Regional Director</td>
290 <td>Brenden Wagner</td>
291 <td>Software Engineer</td>
292 <td>San Francisco</td>
299 <td>Chief Operating Officer (COO)</td>
300 <td>San Francisco</td>
307 <td>Regional Marketing</td>
314 <td>Michelle House</td>
315 <td>Integration Specialist</td>
330 <td>Prescott Bartlett</td>
331 <td>Technical Author</td>
338 <td>Gavin Cortez</td>
340 <td>San Francisco</td>
346 <td>Martena Mccray</td>
347 <td>Post-Sales support</td>
354 <td>Unity Butler</td>
355 <td>Marketing Designer</td>
356 <td>San Francisco</td>
362 <td>Howard Hatfield</td>
363 <td>Office Manager</td>
364 <td>San Francisco</td>
370 <td>Hope Fuentes</td>
372 <td>San Francisco</td>
378 <td>Vivian Harrell</td>
379 <td>Financial Controller</td>
380 <td>San Francisco</td>
386 <td>Timothy Mooney</td>
387 <td>Office Manager</td>
394 <td>Jackson Bradshaw</td>
402 <td>Olivia Liang</td>
403 <td>Support Engineer</td>
411 <td>Software Engineer</td>
418 <td>Sakura Yamamoto</td>
419 <td>Support Engineer</td>
434 <td>Finn Camacho</td>
435 <td>Support Engineer</td>
436 <td>San Francisco</td>
442 <td>Serge Baldwin</td>
443 <td>Data Coordinator</td>
450 <td>Zenaida Frank</td>
451 <td>Software Engineer</td>
458 <td>Zorita Serrano</td>
459 <td>Software Engineer</td>
460 <td>San Francisco</td>
466 <td>Jennifer Acosta</td>
467 <td>Junior Javascript Developer</td>
474 <td>Cara Stevens</td>
475 <td>Sales Assistant</td>
482 <td>Hermione Butler</td>
483 <td>Regional Director</td>
491 <td>Systems Administrator</td>
498 <td>Jonas Alexander</td>
500 <td>San Francisco</td>
507 <td>Regional Director</td>
514 <td>Michael Bruce</td>
515 <td>Javascript Developer</td>
522 <td>Donna Snider</td>
523 <td>Customer Support</td>
533 <li class="active">Javascript</li>
537 <li>Server-side script</li>
542 <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() {
543 var table = $('#example').DataTable();
544 var colvis = new $.fn.dataTable.ColVis( table );
546 $( colvis.button() ).insertAfter('div.info');
549 <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p>
552 <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
553 <li><a href="../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
554 <li><a href="../js/dataTables.colVis.js">../js/dataTables.colVis.js</a></li>
559 <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p>
564 <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
565 additional CSS used is shown below:</p><code class="multiline language-css"></code>
568 <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p>
571 <li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
572 <li><a href="../css/dataTables.colVis.css">../css/dataTables.colVis.css</a></li>
577 <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
582 <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
583 processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables
584 documentation</a>.</p>
592 <div class="gradient"></div>
595 <h2>Other examples</h2>
598 <div class="toc-group">
599 <h3><a href="./index.html">Examples</a></h3>
600 <ul class="toc active">
601 <li><a href="./simple.html">Basic initialisation</a></li>
602 <li class="active"><a href="./new_init.html">`new` initialisation</a></li>
603 <li><a href="./text.html">Custom button text</a></li>
604 <li><a href="./exclude_columns.html">Exclude columns from list</a></li>
605 <li><a href="./title_callback.html">Column button callback</a></li>
606 <li><a href="./button_order.html">Button ordering</a></li>
607 <li><a href="./mouseover.html">Mouseover activation</a></li>
608 <li><a href="./group_columns.html">Group columns</a></li>
609 <li><a href="./two_tables.html">Two tables with individual controls</a></li>
610 <li><a href="./two_tables_identical.html">Two tables with shared controls</a></li>
611 <li><a href="./restore.html">Restore / show all</a></li>
612 <li><a href="./jqueryui.html">jQuery UI styling</a></li>
617 <div class="epilogue">
618 <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br>
619 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>
620 which extend the capabilities of DataTables.</p>
622 <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2015<br>
623 DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>