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>TableTools example - Button collections</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">
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">
24 $(document).ready(function() {
25 $('#example').DataTable( {
26 "dom": 'T<"clear">lfrtip',
32 "sExtends": "collection",
33 "sButtonText": "Save",
34 "aButtons": [ "csv", "xls", "pdf" ]
45 <body class="dt-example">
46 <div class="container">
48 <h1>TableTools example <span>Button collections</span></h1>
51 <p>TableTools provides the ability to group buttons into a hidden drop down list, which is activated by clicking on a top-level button. This is achieved by
52 extending the 'collection' predefined button type and setting it's <code>aButtons</code> parameter with the same options as the top level buttons (note that you
53 cannot currently use a collection within a collection).</p>
55 <p>The example below shows the file save buttons grouped into a collection, while the copy and print buttons are left on the top level.</p>
58 <table id="example" class="display" cellspacing="0" width="100%">
84 <td>System Architect</td>
91 <td>Garrett Winters</td>
100 <td>Junior Technical Author</td>
101 <td>San Francisco</td>
107 <td>Cedric Kelly</td>
108 <td>Senior Javascript Developer</td>
123 <td>Brielle Williamson</td>
124 <td>Integration Specialist</td>
131 <td>Herrod Chandler</td>
132 <td>Sales Assistant</td>
133 <td>San Francisco</td>
139 <td>Rhona Davidson</td>
140 <td>Integration Specialist</td>
147 <td>Colleen Hurst</td>
148 <td>Javascript Developer</td>
149 <td>San Francisco</td>
156 <td>Software Engineer</td>
164 <td>Office Manager</td>
172 <td>Support Lead</td>
179 <td>Charde Marshall</td>
180 <td>Regional Director</td>
181 <td>San Francisco</td>
187 <td>Haley Kennedy</td>
188 <td>Senior Marketing Designer</td>
195 <td>Tatyana Fitzpatrick</td>
196 <td>Regional Director</td>
203 <td>Michael Silva</td>
204 <td>Marketing Designer</td>
212 <td>Chief Financial Officer (CFO)</td>
219 <td>Gloria Little</td>
220 <td>Systems Administrator</td>
227 <td>Bradley Greer</td>
228 <td>Software Engineer</td>
236 <td>Personnel Lead</td>
243 <td>Jenette Caldwell</td>
244 <td>Development Lead</td>
252 <td>Chief Marketing Officer (CMO)</td>
259 <td>Caesar Vance</td>
260 <td>Pre-Sales Support</td>
267 <td>Doris Wilder</td>
268 <td>Sales Assistant</td>
275 <td>Angelica Ramos</td>
276 <td>Chief Executive Officer (CEO)</td>
291 <td>Jennifer Chang</td>
292 <td>Regional Director</td>
299 <td>Brenden Wagner</td>
300 <td>Software Engineer</td>
301 <td>San Francisco</td>
308 <td>Chief Operating Officer (COO)</td>
309 <td>San Francisco</td>
316 <td>Regional Marketing</td>
323 <td>Michelle House</td>
324 <td>Integration Specialist</td>
339 <td>Prescott Bartlett</td>
340 <td>Technical Author</td>
347 <td>Gavin Cortez</td>
349 <td>San Francisco</td>
355 <td>Martena Mccray</td>
356 <td>Post-Sales support</td>
363 <td>Unity Butler</td>
364 <td>Marketing Designer</td>
365 <td>San Francisco</td>
371 <td>Howard Hatfield</td>
372 <td>Office Manager</td>
373 <td>San Francisco</td>
379 <td>Hope Fuentes</td>
381 <td>San Francisco</td>
387 <td>Vivian Harrell</td>
388 <td>Financial Controller</td>
389 <td>San Francisco</td>
395 <td>Timothy Mooney</td>
396 <td>Office Manager</td>
403 <td>Jackson Bradshaw</td>
411 <td>Olivia Liang</td>
412 <td>Support Engineer</td>
420 <td>Software Engineer</td>
427 <td>Sakura Yamamoto</td>
428 <td>Support Engineer</td>
443 <td>Finn Camacho</td>
444 <td>Support Engineer</td>
445 <td>San Francisco</td>
451 <td>Serge Baldwin</td>
452 <td>Data Coordinator</td>
459 <td>Zenaida Frank</td>
460 <td>Software Engineer</td>
467 <td>Zorita Serrano</td>
468 <td>Software Engineer</td>
469 <td>San Francisco</td>
475 <td>Jennifer Acosta</td>
476 <td>Junior Javascript Developer</td>
483 <td>Cara Stevens</td>
484 <td>Sales Assistant</td>
491 <td>Hermione Butler</td>
492 <td>Regional Director</td>
500 <td>Systems Administrator</td>
507 <td>Jonas Alexander</td>
509 <td>San Francisco</td>
516 <td>Regional Director</td>
523 <td>Michael Bruce</td>
524 <td>Javascript Developer</td>
531 <td>Donna Snider</td>
532 <td>Customer Support</td>
542 <li class="active">Javascript</li>
546 <li>Server-side script</li>
551 <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() {
552 $('#example').DataTable( {
553 "dom": 'T<"clear">lfrtip',
554 "tableTools": {
555 "aButtons": [
559 "sExtends": "collection",
560 "sButtonText": "Save",
561 "aButtons": [ "csv", "xls", "pdf" ]
568 <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p>
571 <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
572 <li><a href="../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
573 <li><a href="../js/dataTables.tableTools.js">../js/dataTables.tableTools.js</a></li>
578 <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p>
583 <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
584 additional CSS used is shown below:</p><code class="multiline language-css"></code>
587 <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p>
590 <li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
591 <li><a href="../css/dataTables.tableTools.css">../css/dataTables.tableTools.css</a></li>
596 <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
601 <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
602 processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables
603 documentation</a>.</p>
611 <div class="gradient"></div>
614 <h2>Other examples</h2>
617 <div class="toc-group">
618 <h3><a href="./index.html">Examples</a></h3>
619 <ul class="toc active">
620 <li><a href="./simple.html">Basic initialisation</a></li>
621 <li><a href="./swf_path.html">Setting the SWF path</a></li>
622 <li><a href="./new_init.html">Initialisation with `new`</a></li>
623 <li><a href="./defaults.html">Defaults</a></li>
624 <li><a href="./select_single.html">Row selection - single row select</a></li>
625 <li><a href="./select_multi.html">Row selection - multi-row select</a></li>
626 <li><a href="./select_os.html">Row selection - operating system style</a></li>
627 <li><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
628 <li><a href="./multiple_tables.html">Multiple tables</a></li>
629 <li><a href="./multi_instance.html">Multiple toolbars</a></li>
630 <li class="active"><a href="./collection.html">Button collections</a></li>
631 <li><a href="./plug-in.html">Plug-in button types</a></li>
632 <li><a href="./button_text.html">Custom button text</a></li>
633 <li><a href="./alter_buttons.html">Button arrangement</a></li>
634 <li><a href="./ajax.html">Ajax loaded data</a></li>
635 <li><a href="./pdf_message.html">PDF message</a></li>
636 <li><a href="./bootstrap.html">Bootstrap styling</a></li>
637 <li><a href="./jqueryui.html">jQuery UI styling</a></li>
642 <div class="epilogue">
643 <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br>
644 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>
645 which extend the capabilities of DataTables.</p>
647 <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2015<br>
648 DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>