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 - Custom button text</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',
31 "sButtonText": "Copy to clipboard"
35 "sButtonText": "Save to CSV"
52 <body class="dt-example">
53 <div class="container">
55 <h1>TableTools example <span>Custom button text</span></h1>
58 <p>You may wish to set your own text for the buttons in the TableTools toolbar, rather than relying on the default built-in text. This is done by overriding the
59 <code>sButtonText</code> parameter of whatever button you wish to alter. The way TableTools allows you to alter a predefined button is by 'extending' it (using the
60 <code>sExtends</code> parameter) and then setting the overriding parameter.</p>
62 <p>A full list of the parameters which can be used is <a href="http://datatables.net/extensions/tabletools/button_options">available on the DataTables.net
63 web-site</a>. This example shows how to set the button text as required.</p>
66 <table id="example" class="display" cellspacing="0" width="100%">
92 <td>System Architect</td>
99 <td>Garrett Winters</td>
108 <td>Junior Technical Author</td>
109 <td>San Francisco</td>
115 <td>Cedric Kelly</td>
116 <td>Senior Javascript Developer</td>
131 <td>Brielle Williamson</td>
132 <td>Integration Specialist</td>
139 <td>Herrod Chandler</td>
140 <td>Sales Assistant</td>
141 <td>San Francisco</td>
147 <td>Rhona Davidson</td>
148 <td>Integration Specialist</td>
155 <td>Colleen Hurst</td>
156 <td>Javascript Developer</td>
157 <td>San Francisco</td>
164 <td>Software Engineer</td>
172 <td>Office Manager</td>
180 <td>Support Lead</td>
187 <td>Charde Marshall</td>
188 <td>Regional Director</td>
189 <td>San Francisco</td>
195 <td>Haley Kennedy</td>
196 <td>Senior Marketing Designer</td>
203 <td>Tatyana Fitzpatrick</td>
204 <td>Regional Director</td>
211 <td>Michael Silva</td>
212 <td>Marketing Designer</td>
220 <td>Chief Financial Officer (CFO)</td>
227 <td>Gloria Little</td>
228 <td>Systems Administrator</td>
235 <td>Bradley Greer</td>
236 <td>Software Engineer</td>
244 <td>Personnel Lead</td>
251 <td>Jenette Caldwell</td>
252 <td>Development Lead</td>
260 <td>Chief Marketing Officer (CMO)</td>
267 <td>Caesar Vance</td>
268 <td>Pre-Sales Support</td>
275 <td>Doris Wilder</td>
276 <td>Sales Assistant</td>
283 <td>Angelica Ramos</td>
284 <td>Chief Executive Officer (CEO)</td>
299 <td>Jennifer Chang</td>
300 <td>Regional Director</td>
307 <td>Brenden Wagner</td>
308 <td>Software Engineer</td>
309 <td>San Francisco</td>
316 <td>Chief Operating Officer (COO)</td>
317 <td>San Francisco</td>
324 <td>Regional Marketing</td>
331 <td>Michelle House</td>
332 <td>Integration Specialist</td>
347 <td>Prescott Bartlett</td>
348 <td>Technical Author</td>
355 <td>Gavin Cortez</td>
357 <td>San Francisco</td>
363 <td>Martena Mccray</td>
364 <td>Post-Sales support</td>
371 <td>Unity Butler</td>
372 <td>Marketing Designer</td>
373 <td>San Francisco</td>
379 <td>Howard Hatfield</td>
380 <td>Office Manager</td>
381 <td>San Francisco</td>
387 <td>Hope Fuentes</td>
389 <td>San Francisco</td>
395 <td>Vivian Harrell</td>
396 <td>Financial Controller</td>
397 <td>San Francisco</td>
403 <td>Timothy Mooney</td>
404 <td>Office Manager</td>
411 <td>Jackson Bradshaw</td>
419 <td>Olivia Liang</td>
420 <td>Support Engineer</td>
428 <td>Software Engineer</td>
435 <td>Sakura Yamamoto</td>
436 <td>Support Engineer</td>
451 <td>Finn Camacho</td>
452 <td>Support Engineer</td>
453 <td>San Francisco</td>
459 <td>Serge Baldwin</td>
460 <td>Data Coordinator</td>
467 <td>Zenaida Frank</td>
468 <td>Software Engineer</td>
475 <td>Zorita Serrano</td>
476 <td>Software Engineer</td>
477 <td>San Francisco</td>
483 <td>Jennifer Acosta</td>
484 <td>Junior Javascript Developer</td>
491 <td>Cara Stevens</td>
492 <td>Sales Assistant</td>
499 <td>Hermione Butler</td>
500 <td>Regional Director</td>
508 <td>Systems Administrator</td>
515 <td>Jonas Alexander</td>
517 <td>San Francisco</td>
524 <td>Regional Director</td>
531 <td>Michael Bruce</td>
532 <td>Javascript Developer</td>
539 <td>Donna Snider</td>
540 <td>Customer Support</td>
550 <li class="active">Javascript</li>
554 <li>Server-side script</li>
559 <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() {
560 $('#example').DataTable( {
561 "dom": 'T<"clear">lfrtip',
562 "tableTools": {
563 "aButtons": [
565 "sExtends": "copy",
566 "sButtonText": "Copy to clipboard"
569 "sExtends": "csv",
570 "sButtonText": "Save to CSV"
573 "sExtends": "xls",
574 "oSelectorOpts": {
583 <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p>
586 <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
587 <li><a href="../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
588 <li><a href="../js/dataTables.tableTools.js">../js/dataTables.tableTools.js</a></li>
593 <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p>
598 <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
599 additional CSS used is shown below:</p><code class="multiline language-css"></code>
602 <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p>
605 <li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
606 <li><a href="../css/dataTables.tableTools.css">../css/dataTables.tableTools.css</a></li>
611 <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
616 <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
617 processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables
618 documentation</a>.</p>
626 <div class="gradient"></div>
629 <h2>Other examples</h2>
632 <div class="toc-group">
633 <h3><a href="./index.html">Examples</a></h3>
634 <ul class="toc active">
635 <li><a href="./simple.html">Basic initialisation</a></li>
636 <li><a href="./swf_path.html">Setting the SWF path</a></li>
637 <li><a href="./new_init.html">Initialisation with `new`</a></li>
638 <li><a href="./defaults.html">Defaults</a></li>
639 <li><a href="./select_single.html">Row selection - single row select</a></li>
640 <li><a href="./select_multi.html">Row selection - multi-row select</a></li>
641 <li><a href="./select_os.html">Row selection - operating system style</a></li>
642 <li><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
643 <li><a href="./multiple_tables.html">Multiple tables</a></li>
644 <li><a href="./multi_instance.html">Multiple toolbars</a></li>
645 <li><a href="./collection.html">Button collections</a></li>
646 <li><a href="./plug-in.html">Plug-in button types</a></li>
647 <li class="active"><a href="./button_text.html">Custom button text</a></li>
648 <li><a href="./alter_buttons.html">Button arrangement</a></li>
649 <li><a href="./ajax.html">Ajax loaded data</a></li>
650 <li><a href="./pdf_message.html">PDF message</a></li>
651 <li><a href="./bootstrap.html">Bootstrap styling</a></li>
652 <li><a href="./jqueryui.html">jQuery UI styling</a></li>
657 <div class="epilogue">
658 <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br>
659 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>
660 which extend the capabilities of DataTables.</p>
662 <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2015<br>
663 DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>