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 - Group columns</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 $('#example').DataTable( {
26 dom: 'C<"clear">lfrtip',
47 <body class="dt-example">
48 <div class="container">
50 <h1>ColVis example <span>Group columns</span></h1>
53 <p>It can be useful at times to show and hide multiple columns together - i.e. grouping them together. Groupings are defined by the <code>groups</code> array.
54 Create a group button by naming it (using the <code>title</code> option) and specifying by index which columns belong to it (using the <code>columns</code>
57 <p>Note also that this ability to create groups can be used in combination <code>exclude</code> to remove individual columns from the list (should you wish them to
58 only be used in the groups), or set <code>exclude = [ 'all' ]</code> to show only the grouping buttons (i.e. individual column control buttons will not be
61 <p>For full information about the ColVis options, please refer to the <a href="//datatables.net/extensions/colvis/options">ColVis options documentation</a>.</p>
64 <table id="example" class="display" cellspacing="0" width="100%">
90 <td>System Architect</td>
97 <td>Garrett Winters</td>
106 <td>Junior Technical Author</td>
107 <td>San Francisco</td>
113 <td>Cedric Kelly</td>
114 <td>Senior Javascript Developer</td>
129 <td>Brielle Williamson</td>
130 <td>Integration Specialist</td>
137 <td>Herrod Chandler</td>
138 <td>Sales Assistant</td>
139 <td>San Francisco</td>
145 <td>Rhona Davidson</td>
146 <td>Integration Specialist</td>
153 <td>Colleen Hurst</td>
154 <td>Javascript Developer</td>
155 <td>San Francisco</td>
162 <td>Software Engineer</td>
170 <td>Office Manager</td>
178 <td>Support Lead</td>
185 <td>Charde Marshall</td>
186 <td>Regional Director</td>
187 <td>San Francisco</td>
193 <td>Haley Kennedy</td>
194 <td>Senior Marketing Designer</td>
201 <td>Tatyana Fitzpatrick</td>
202 <td>Regional Director</td>
209 <td>Michael Silva</td>
210 <td>Marketing Designer</td>
218 <td>Chief Financial Officer (CFO)</td>
225 <td>Gloria Little</td>
226 <td>Systems Administrator</td>
233 <td>Bradley Greer</td>
234 <td>Software Engineer</td>
242 <td>Personnel Lead</td>
249 <td>Jenette Caldwell</td>
250 <td>Development Lead</td>
258 <td>Chief Marketing Officer (CMO)</td>
265 <td>Caesar Vance</td>
266 <td>Pre-Sales Support</td>
273 <td>Doris Wilder</td>
274 <td>Sales Assistant</td>
281 <td>Angelica Ramos</td>
282 <td>Chief Executive Officer (CEO)</td>
297 <td>Jennifer Chang</td>
298 <td>Regional Director</td>
305 <td>Brenden Wagner</td>
306 <td>Software Engineer</td>
307 <td>San Francisco</td>
314 <td>Chief Operating Officer (COO)</td>
315 <td>San Francisco</td>
322 <td>Regional Marketing</td>
329 <td>Michelle House</td>
330 <td>Integration Specialist</td>
345 <td>Prescott Bartlett</td>
346 <td>Technical Author</td>
353 <td>Gavin Cortez</td>
355 <td>San Francisco</td>
361 <td>Martena Mccray</td>
362 <td>Post-Sales support</td>
369 <td>Unity Butler</td>
370 <td>Marketing Designer</td>
371 <td>San Francisco</td>
377 <td>Howard Hatfield</td>
378 <td>Office Manager</td>
379 <td>San Francisco</td>
385 <td>Hope Fuentes</td>
387 <td>San Francisco</td>
393 <td>Vivian Harrell</td>
394 <td>Financial Controller</td>
395 <td>San Francisco</td>
401 <td>Timothy Mooney</td>
402 <td>Office Manager</td>
409 <td>Jackson Bradshaw</td>
417 <td>Olivia Liang</td>
418 <td>Support Engineer</td>
426 <td>Software Engineer</td>
433 <td>Sakura Yamamoto</td>
434 <td>Support Engineer</td>
449 <td>Finn Camacho</td>
450 <td>Support Engineer</td>
451 <td>San Francisco</td>
457 <td>Serge Baldwin</td>
458 <td>Data Coordinator</td>
465 <td>Zenaida Frank</td>
466 <td>Software Engineer</td>
473 <td>Zorita Serrano</td>
474 <td>Software Engineer</td>
475 <td>San Francisco</td>
481 <td>Jennifer Acosta</td>
482 <td>Junior Javascript Developer</td>
489 <td>Cara Stevens</td>
490 <td>Sales Assistant</td>
497 <td>Hermione Butler</td>
498 <td>Regional Director</td>
506 <td>Systems Administrator</td>
513 <td>Jonas Alexander</td>
515 <td>San Francisco</td>
522 <td>Regional Director</td>
529 <td>Michael Bruce</td>
530 <td>Javascript Developer</td>
537 <td>Donna Snider</td>
538 <td>Customer Support</td>
548 <li class="active">Javascript</li>
552 <li>Server-side script</li>
557 <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() {
558 $('#example').DataTable( {
559 dom: 'C<"clear">lfrtip',
564 title: "Engine",
568 title: "Client",
576 <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p>
579 <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
580 <li><a href="../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
581 <li><a href="../js/dataTables.colVis.js">../js/dataTables.colVis.js</a></li>
586 <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p>
591 <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
592 additional CSS used is shown below:</p><code class="multiline language-css"></code>
595 <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p>
598 <li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
599 <li><a href="../css/dataTables.colVis.css">../css/dataTables.colVis.css</a></li>
604 <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
609 <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
610 processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables
611 documentation</a>.</p>
619 <div class="gradient"></div>
622 <h2>Other examples</h2>
625 <div class="toc-group">
626 <h3><a href="./index.html">Examples</a></h3>
627 <ul class="toc active">
628 <li><a href="./simple.html">Basic initialisation</a></li>
629 <li><a href="./new_init.html">`new` initialisation</a></li>
630 <li><a href="./text.html">Custom button text</a></li>
631 <li><a href="./exclude_columns.html">Exclude columns from list</a></li>
632 <li><a href="./title_callback.html">Column button callback</a></li>
633 <li><a href="./button_order.html">Button ordering</a></li>
634 <li><a href="./mouseover.html">Mouseover activation</a></li>
635 <li class="active"><a href="./group_columns.html">Group columns</a></li>
636 <li><a href="./two_tables.html">Two tables with individual controls</a></li>
637 <li><a href="./two_tables_identical.html">Two tables with shared controls</a></li>
638 <li><a href="./restore.html">Restore / show all</a></li>
639 <li><a href="./jqueryui.html">jQuery UI styling</a></li>
644 <div class="epilogue">
645 <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br>
646 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>
647 which extend the capabilities of DataTables.</p>
649 <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2015<br>
650 DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>