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 - Row selection - single row select</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">
25 $(document).ready(function() {
26 $('#example').DataTable( {
27 dom: 'T<"clear">lfrtip',
29 "sRowSelect": "single"
38 <body class="dt-example">
39 <div class="container">
41 <h1>TableTools example <span>Row selection - single row select</span></h1>
44 <p>As well as providing a button toolbar, TableTools provides everything needed to have selectable rows in the table. TableTools has four row selection modes of
48 <li><code>none</code> - Default, where no user row selection options are available</li>
49 <li><code>single</code> - A single row can be selected</li>
50 <li><code>multi</code> - Multiple rows can be selected simply by clicking on the rows</li>
51 <li><code>os</code> - Operating System like selection where you can use the shift and ctrl / cmd keys on your keyboard to add / remove rows from the
55 <p>This example shows the <code>single</code> select option.</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',
555 "sRowSelect": "single"
560 <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p>
563 <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
564 <li><a href="../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
565 <li><a href="../js/dataTables.tableTools.js">../js/dataTables.tableTools.js</a></li>
570 <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p>
575 <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
576 additional CSS used is shown below:</p><code class="multiline language-css"></code>
579 <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p>
582 <li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
583 <li><a href="../css/dataTables.tableTools.css">../css/dataTables.tableTools.css</a></li>
588 <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
593 <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
594 processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables
595 documentation</a>.</p>
603 <div class="gradient"></div>
606 <h2>Other examples</h2>
609 <div class="toc-group">
610 <h3><a href="./index.html">Examples</a></h3>
611 <ul class="toc active">
612 <li><a href="./simple.html">Basic initialisation</a></li>
613 <li><a href="./swf_path.html">Setting the SWF path</a></li>
614 <li><a href="./new_init.html">Initialisation with `new`</a></li>
615 <li><a href="./defaults.html">Defaults</a></li>
616 <li class="active"><a href="./select_single.html">Row selection - single row select</a></li>
617 <li><a href="./select_multi.html">Row selection - multi-row select</a></li>
618 <li><a href="./select_os.html">Row selection - operating system style</a></li>
619 <li><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
620 <li><a href="./multiple_tables.html">Multiple tables</a></li>
621 <li><a href="./multi_instance.html">Multiple toolbars</a></li>
622 <li><a href="./collection.html">Button collections</a></li>
623 <li><a href="./plug-in.html">Plug-in button types</a></li>
624 <li><a href="./button_text.html">Custom button text</a></li>
625 <li><a href="./alter_buttons.html">Button arrangement</a></li>
626 <li><a href="./ajax.html">Ajax loaded data</a></li>
627 <li><a href="./pdf_message.html">PDF message</a></li>
628 <li><a href="./bootstrap.html">Bootstrap styling</a></li>
629 <li><a href="./jqueryui.html">jQuery UI styling</a></li>
634 <div class="epilogue">
635 <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br>
636 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>
637 which extend the capabilities of DataTables.</p>
639 <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2015<br>
640 DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>