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>Responsive example - Automatic column hiding
</title>
9 <link rel=
"stylesheet" type=
"text/css" href=
"../../../../media/css/jquery.dataTables.css">
10 <link rel=
"stylesheet" type=
"text/css" href=
"../../css/dataTables.responsive.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.responsive.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();
34 <body class=
"dt-example">
35 <div class=
"container">
37 <h1>Responsive example
<span>Automatic column hiding
</span></h1>
40 <p>Responsive will automatically detect which columns have breakpoint class names assigned to them for visibility control. If no breakpoint class is found for a
41 column, Responsive will determine automatically if the column should be shown or not at any particular viewport width. This is done by removing columns which cause
42 the table to overflow the viewport, with the columns being removed from the right.
</p>
44 <p>This example shows that simple case. On a desktop browser resize the window horizontally to see columns added and removed on-the-fly. On a tablet or mobile
45 browser, change the screen's orientation.
</p>
48 <table id=
"example" class=
"display responsive nowrap" cellspacing=
"0" width=
"100%">
67 <td>System Architect
</td>
73 <td>t.nixon@datatables.net
</td>
84 <td>g.winters@datatables.net
</td>
89 <td>Junior Technical Author
</td>
90 <td>San Francisco
</td>
95 <td>a.cox@datatables.net
</td>
100 <td>Senior Javascript Developer
</td>
106 <td>c.kelly@datatables.net
</td>
117 <td>a.satou@datatables.net
</td>
122 <td>Integration Specialist
</td>
128 <td>b.williamson@datatables.net
</td>
133 <td>Sales Assistant
</td>
134 <td>San Francisco
</td>
139 <td>h.chandler@datatables.net
</td>
144 <td>Integration Specialist
</td>
150 <td>r.davidson@datatables.net
</td>
155 <td>Javascript Developer
</td>
156 <td>San Francisco
</td>
161 <td>c.hurst@datatables.net
</td>
166 <td>Software Engineer
</td>
172 <td>s.frost@datatables.net
</td>
177 <td>Office Manager
</td>
183 <td>j.gaines@datatables.net
</td>
188 <td>Support Lead
</td>
194 <td>q.flynn@datatables.net
</td>
199 <td>Regional Director
</td>
200 <td>San Francisco
</td>
205 <td>c.marshall@datatables.net
</td>
210 <td>Senior Marketing Designer
</td>
216 <td>h.kennedy@datatables.net
</td>
221 <td>Regional Director
</td>
227 <td>t.fitzpatrick@datatables.net
</td>
232 <td>Marketing Designer
</td>
238 <td>m.silva@datatables.net
</td>
243 <td>Chief Financial Officer (CFO)
</td>
249 <td>p.byrd@datatables.net
</td>
254 <td>Systems Administrator
</td>
260 <td>g.little@datatables.net
</td>
265 <td>Software Engineer
</td>
271 <td>b.greer@datatables.net
</td>
276 <td>Personnel Lead
</td>
282 <td>d.rios@datatables.net
</td>
287 <td>Development Lead
</td>
293 <td>j.caldwell@datatables.net
</td>
298 <td>Chief Marketing Officer (CMO)
</td>
304 <td>y.berry@datatables.net
</td>
309 <td>Pre-Sales Support
</td>
315 <td>c.vance@datatables.net
</td>
320 <td>Sales Assistant
</td>
326 <td>d.wilder@datatables.net
</td>
331 <td>Chief Executive Officer (CEO)
</td>
337 <td>a.ramos@datatables.net
</td>
348 <td>g.joyce@datatables.net
</td>
353 <td>Regional Director
</td>
359 <td>j.chang@datatables.net
</td>
364 <td>Software Engineer
</td>
365 <td>San Francisco
</td>
370 <td>b.wagner@datatables.net
</td>
375 <td>Chief Operating Officer (COO)
</td>
376 <td>San Francisco
</td>
381 <td>f.green@datatables.net
</td>
386 <td>Regional Marketing
</td>
392 <td>s.itou@datatables.net
</td>
397 <td>Integration Specialist
</td>
403 <td>m.house@datatables.net
</td>
414 <td>s.burks@datatables.net
</td>
419 <td>Technical Author
</td>
425 <td>p.bartlett@datatables.net
</td>
431 <td>San Francisco
</td>
436 <td>g.cortez@datatables.net
</td>
441 <td>Post-Sales support
</td>
447 <td>m.mccray@datatables.net
</td>
452 <td>Marketing Designer
</td>
453 <td>San Francisco
</td>
458 <td>u.butler@datatables.net
</td>
463 <td>Office Manager
</td>
464 <td>San Francisco
</td>
469 <td>h.hatfield@datatables.net
</td>
475 <td>San Francisco
</td>
480 <td>h.fuentes@datatables.net
</td>
485 <td>Financial Controller
</td>
486 <td>San Francisco
</td>
491 <td>v.harrell@datatables.net
</td>
496 <td>Office Manager
</td>
502 <td>t.mooney@datatables.net
</td>
513 <td>j.bradshaw@datatables.net
</td>
518 <td>Support Engineer
</td>
524 <td>o.liang@datatables.net
</td>
529 <td>Software Engineer
</td>
535 <td>b.nash@datatables.net
</td>
540 <td>Support Engineer
</td>
546 <td>s.yamamoto@datatables.net
</td>
557 <td>t.walton@datatables.net
</td>
562 <td>Support Engineer
</td>
563 <td>San Francisco
</td>
568 <td>f.camacho@datatables.net
</td>
573 <td>Data Coordinator
</td>
579 <td>s.baldwin@datatables.net
</td>
584 <td>Software Engineer
</td>
590 <td>z.frank@datatables.net
</td>
595 <td>Software Engineer
</td>
596 <td>San Francisco
</td>
601 <td>z.serrano@datatables.net
</td>
606 <td>Junior Javascript Developer
</td>
612 <td>j.acosta@datatables.net
</td>
617 <td>Sales Assistant
</td>
623 <td>c.stevens@datatables.net
</td>
628 <td>Regional Director
</td>
634 <td>h.butler@datatables.net
</td>
639 <td>Systems Administrator
</td>
645 <td>l.greer@datatables.net
</td>
651 <td>San Francisco
</td>
656 <td>j.alexander@datatables.net
</td>
661 <td>Regional Director
</td>
667 <td>s.decker@datatables.net
</td>
672 <td>Javascript Developer
</td>
678 <td>m.bruce@datatables.net
</td>
683 <td>Customer Support
</td>
689 <td>d.snider@datatables.net
</td>
695 <li class=
"active">Javascript
</li>
699 <li>Server-side script
</li>
704 <p>The Javascript shown below is used to initialise the table shown in this example:
</p><code class=
"multiline language-js">$(document).ready(function() {
705 $('#example').DataTable();
708 <p>In addition to the above code, the following Javascript library files are loaded for use in this example:
</p>
711 <li><a href=
"../../../../media/js/jquery.js">../../../../media/js/jquery.js
</a></li>
712 <li><a href=
"../../../../media/js/jquery.dataTables.js">../../../../media/js/jquery.dataTables.js
</a></li>
713 <li><a href=
"../../js/dataTables.responsive.js">../../js/dataTables.responsive.js
</a></li>
718 <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:
</p>
723 <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
724 additional CSS used is shown below:
</p><code class=
"multiline language-css"></code>
727 <p>The following CSS library files are loaded for use in this example to provide the styling of the table:
</p>
730 <li><a href=
"../../../../media/css/jquery.dataTables.css">../../../../media/css/jquery.dataTables.css
</a></li>
731 <li><a href=
"../../css/dataTables.responsive.css">../../css/dataTables.responsive.css
</a></li>
736 <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
741 <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
742 processing scripts can be written in any language, using
<a href=
"//datatables.net/manual/server-side">the protocol described in the DataTables
743 documentation
</a>.
</p>
751 <div class=
"gradient"></div>
754 <h2>Other examples
</h2>
757 <div class=
"toc-group">
758 <h3><a href=
"../initialisation/index.html">Basic initialisation
</a></h3>
760 <li><a href=
"../initialisation/className.html">Class name
</a></li>
761 <li><a href=
"../initialisation/option.html">Configuration option
</a></li>
762 <li><a href=
"../initialisation/new.html">`new` constructor
</a></li>
763 <li><a href=
"../initialisation/ajax.html">Ajax data
</a></li>
764 <li><a href=
"../initialisation/default.html">Default initialisation
</a></li>
768 <div class=
"toc-group">
769 <h3><a href=
"../styling/index.html">Styling
</a></h3>
771 <li><a href=
"../styling/bootstrap.html">Bootstrap styling
</a></li>
772 <li><a href=
"../styling/foundation.html">Foundation styling
</a></li>
773 <li><a href=
"../styling/scrolling.html">Vertical scrolling
</a></li>
774 <li><a href=
"../styling/compact.html">Compact styling
</a></li>
778 <div class=
"toc-group">
779 <h3><a href=
"./index.html">Display control
</a></h3>
780 <ul class=
"toc active">
781 <li class=
"active"><a href=
"./auto.html">Automatic column hiding
</a></li>
782 <li><a href=
"./classes.html">Class control
</a></li>
783 <li><a href=
"./init-classes.html">Assigned class control
</a></li>
784 <li><a href=
"./fixedHeader.html">With FixedHeader
</a></li>
785 <li><a href=
"./complexHeader.html">Complex headers (rowspan / colspan)
</a></li>
789 <div class=
"toc-group">
790 <h3><a href=
"../child-rows/index.html">Child rows
</a></h3>
792 <li><a href=
"../child-rows/disable-child-rows.html">Disable child rows
</a></li>
793 <li><a href=
"../child-rows/column-control.html">Column controlled child rows
</a></li>
794 <li><a href=
"../child-rows/right-column.html">Column control - right
</a></li>
795 <li><a href=
"../child-rows/whole-row-control.html">Whole row child row control
</a></li>
796 <li><a href=
"../child-rows/custom-renderer.html">Custom child row renderer
</a></li>
801 <div class=
"epilogue">
802 <p>Please refer to the
<a href=
"http://www.datatables.net">DataTables documentation
</a> for full information about its API properties and methods.
<br>
803 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>
804 which extend the capabilities of DataTables.
</p>
806 <p class=
"copyright">DataTables designed and created by
<a href=
"http://www.sprymedia.co.uk">SpryMedia Ltd
</a> © 2007-
2015<br>
807 DataTables is licensed under the
<a href=
"http://www.datatables.net/mit">MIT license
</a>.
</p>