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 - Default initialisation
</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 $.extend( $.fn.dataTable.defaults, {
29 $(document).ready(function() {
30 $('#example').DataTable();
38 <body class=
"dt-example">
39 <div class=
"container">
41 <h1>Responsive example
<span>Default initialisation
</span></h1>
44 <p>It can often be useful to be able to set a default value for DataTables' initialisation options, providing a common starting point for initialisation when
45 working with multiple tables over many pages or even just on a single page. DataTables provides that ability through the
<code>$.fn.dataTable.defaults
</code>
46 object which can have any of the
<a href=
"//datatables.net/reference/option">initialisation options
</a> set.
</p>
48 <p>Extending that ability, Responsive can also be set to initialise by default, as shown in this example thorugh the
49 <code>$.fn.dataTable.defaults.responsive
</code> property. Extending that,
<a href=
"//datatables.net/extensions/responsive/reference/option/">all of the Responsive
50 options
</a> can also be set using this configuration option (i.e. use
<code>responsive
</code> as an object).
</p>
53 <table id=
"example" class=
"display nowrap" cellspacing=
"0" width=
"100%">
72 <td>System Architect
</td>
78 <td>t.nixon@datatables.net
</td>
89 <td>g.winters@datatables.net
</td>
94 <td>Junior Technical Author
</td>
95 <td>San Francisco
</td>
100 <td>a.cox@datatables.net
</td>
105 <td>Senior Javascript Developer
</td>
111 <td>c.kelly@datatables.net
</td>
122 <td>a.satou@datatables.net
</td>
127 <td>Integration Specialist
</td>
133 <td>b.williamson@datatables.net
</td>
138 <td>Sales Assistant
</td>
139 <td>San Francisco
</td>
144 <td>h.chandler@datatables.net
</td>
149 <td>Integration Specialist
</td>
155 <td>r.davidson@datatables.net
</td>
160 <td>Javascript Developer
</td>
161 <td>San Francisco
</td>
166 <td>c.hurst@datatables.net
</td>
171 <td>Software Engineer
</td>
177 <td>s.frost@datatables.net
</td>
182 <td>Office Manager
</td>
188 <td>j.gaines@datatables.net
</td>
193 <td>Support Lead
</td>
199 <td>q.flynn@datatables.net
</td>
204 <td>Regional Director
</td>
205 <td>San Francisco
</td>
210 <td>c.marshall@datatables.net
</td>
215 <td>Senior Marketing Designer
</td>
221 <td>h.kennedy@datatables.net
</td>
226 <td>Regional Director
</td>
232 <td>t.fitzpatrick@datatables.net
</td>
237 <td>Marketing Designer
</td>
243 <td>m.silva@datatables.net
</td>
248 <td>Chief Financial Officer (CFO)
</td>
254 <td>p.byrd@datatables.net
</td>
259 <td>Systems Administrator
</td>
265 <td>g.little@datatables.net
</td>
270 <td>Software Engineer
</td>
276 <td>b.greer@datatables.net
</td>
281 <td>Personnel Lead
</td>
287 <td>d.rios@datatables.net
</td>
292 <td>Development Lead
</td>
298 <td>j.caldwell@datatables.net
</td>
303 <td>Chief Marketing Officer (CMO)
</td>
309 <td>y.berry@datatables.net
</td>
314 <td>Pre-Sales Support
</td>
320 <td>c.vance@datatables.net
</td>
325 <td>Sales Assistant
</td>
331 <td>d.wilder@datatables.net
</td>
336 <td>Chief Executive Officer (CEO)
</td>
342 <td>a.ramos@datatables.net
</td>
353 <td>g.joyce@datatables.net
</td>
358 <td>Regional Director
</td>
364 <td>j.chang@datatables.net
</td>
369 <td>Software Engineer
</td>
370 <td>San Francisco
</td>
375 <td>b.wagner@datatables.net
</td>
380 <td>Chief Operating Officer (COO)
</td>
381 <td>San Francisco
</td>
386 <td>f.green@datatables.net
</td>
391 <td>Regional Marketing
</td>
397 <td>s.itou@datatables.net
</td>
402 <td>Integration Specialist
</td>
408 <td>m.house@datatables.net
</td>
419 <td>s.burks@datatables.net
</td>
424 <td>Technical Author
</td>
430 <td>p.bartlett@datatables.net
</td>
436 <td>San Francisco
</td>
441 <td>g.cortez@datatables.net
</td>
446 <td>Post-Sales support
</td>
452 <td>m.mccray@datatables.net
</td>
457 <td>Marketing Designer
</td>
458 <td>San Francisco
</td>
463 <td>u.butler@datatables.net
</td>
468 <td>Office Manager
</td>
469 <td>San Francisco
</td>
474 <td>h.hatfield@datatables.net
</td>
480 <td>San Francisco
</td>
485 <td>h.fuentes@datatables.net
</td>
490 <td>Financial Controller
</td>
491 <td>San Francisco
</td>
496 <td>v.harrell@datatables.net
</td>
501 <td>Office Manager
</td>
507 <td>t.mooney@datatables.net
</td>
518 <td>j.bradshaw@datatables.net
</td>
523 <td>Support Engineer
</td>
529 <td>o.liang@datatables.net
</td>
534 <td>Software Engineer
</td>
540 <td>b.nash@datatables.net
</td>
545 <td>Support Engineer
</td>
551 <td>s.yamamoto@datatables.net
</td>
562 <td>t.walton@datatables.net
</td>
567 <td>Support Engineer
</td>
568 <td>San Francisco
</td>
573 <td>f.camacho@datatables.net
</td>
578 <td>Data Coordinator
</td>
584 <td>s.baldwin@datatables.net
</td>
589 <td>Software Engineer
</td>
595 <td>z.frank@datatables.net
</td>
600 <td>Software Engineer
</td>
601 <td>San Francisco
</td>
606 <td>z.serrano@datatables.net
</td>
611 <td>Junior Javascript Developer
</td>
617 <td>j.acosta@datatables.net
</td>
622 <td>Sales Assistant
</td>
628 <td>c.stevens@datatables.net
</td>
633 <td>Regional Director
</td>
639 <td>h.butler@datatables.net
</td>
644 <td>Systems Administrator
</td>
650 <td>l.greer@datatables.net
</td>
656 <td>San Francisco
</td>
661 <td>j.alexander@datatables.net
</td>
666 <td>Regional Director
</td>
672 <td>s.decker@datatables.net
</td>
677 <td>Javascript Developer
</td>
683 <td>m.bruce@datatables.net
</td>
688 <td>Customer Support
</td>
694 <td>d.snider@datatables.net
</td>
700 <li class=
"active">Javascript
</li>
704 <li>Server-side script
</li>
709 <p>The Javascript shown below is used to initialise the table shown in this example:
</p><code class=
"multiline language-js">$.extend( $.fn.dataTable.defaults, {
713 $(document).ready(function() {
714 $('#example').DataTable();
717 <p>In addition to the above code, the following Javascript library files are loaded for use in this example:
</p>
720 <li><a href=
"../../../../media/js/jquery.js">../../../../media/js/jquery.js
</a></li>
721 <li><a href=
"../../../../media/js/jquery.dataTables.js">../../../../media/js/jquery.dataTables.js
</a></li>
722 <li><a href=
"../../js/dataTables.responsive.js">../../js/dataTables.responsive.js
</a></li>
727 <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:
</p>
732 <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
733 additional CSS used is shown below:
</p><code class=
"multiline language-css"></code>
736 <p>The following CSS library files are loaded for use in this example to provide the styling of the table:
</p>
739 <li><a href=
"../../../../media/css/jquery.dataTables.css">../../../../media/css/jquery.dataTables.css
</a></li>
740 <li><a href=
"../../css/dataTables.responsive.css">../../css/dataTables.responsive.css
</a></li>
745 <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
750 <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
751 processing scripts can be written in any language, using
<a href=
"//datatables.net/manual/server-side">the protocol described in the DataTables
752 documentation
</a>.
</p>
760 <div class=
"gradient"></div>
763 <h2>Other examples
</h2>
766 <div class=
"toc-group">
767 <h3><a href=
"./index.html">Basic initialisation
</a></h3>
768 <ul class=
"toc active">
769 <li><a href=
"./className.html">Class name
</a></li>
770 <li><a href=
"./option.html">Configuration option
</a></li>
771 <li><a href=
"./new.html">`new` constructor
</a></li>
772 <li><a href=
"./ajax.html">Ajax data
</a></li>
773 <li class=
"active"><a href=
"./default.html">Default initialisation
</a></li>
777 <div class=
"toc-group">
778 <h3><a href=
"../styling/index.html">Styling
</a></h3>
780 <li><a href=
"../styling/bootstrap.html">Bootstrap styling
</a></li>
781 <li><a href=
"../styling/foundation.html">Foundation styling
</a></li>
782 <li><a href=
"../styling/scrolling.html">Vertical scrolling
</a></li>
783 <li><a href=
"../styling/compact.html">Compact styling
</a></li>
787 <div class=
"toc-group">
788 <h3><a href=
"../display-control/index.html">Display control
</a></h3>
790 <li><a href=
"../display-control/auto.html">Automatic column hiding
</a></li>
791 <li><a href=
"../display-control/classes.html">Class control
</a></li>
792 <li><a href=
"../display-control/init-classes.html">Assigned class control
</a></li>
793 <li><a href=
"../display-control/fixedHeader.html">With FixedHeader
</a></li>
794 <li><a href=
"../display-control/complexHeader.html">Complex headers (rowspan / colspan)
</a></li>
798 <div class=
"toc-group">
799 <h3><a href=
"../child-rows/index.html">Child rows
</a></h3>
801 <li><a href=
"../child-rows/disable-child-rows.html">Disable child rows
</a></li>
802 <li><a href=
"../child-rows/column-control.html">Column controlled child rows
</a></li>
803 <li><a href=
"../child-rows/right-column.html">Column control - right
</a></li>
804 <li><a href=
"../child-rows/whole-row-control.html">Whole row child row control
</a></li>
805 <li><a href=
"../child-rows/custom-renderer.html">Custom child row renderer
</a></li>
810 <div class=
"epilogue">
811 <p>Please refer to the
<a href=
"http://www.datatables.net">DataTables documentation
</a> for full information about its API properties and methods.
<br>
812 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>
813 which extend the capabilities of DataTables.
</p>
815 <p class=
"copyright">DataTables designed and created by
<a href=
"http://www.sprymedia.co.uk">SpryMedia Ltd
</a> © 2007-
2015<br>
816 DataTables is licensed under the
<a href=
"http://www.datatables.net/mit">MIT license
</a>.
</p>