init-classes.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  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">
  7. <title>Responsive example - Assigned class control</title>
  8. <link rel="stylesheet" type="text/css" href="../../../../media/css/jquery.dataTables.css">
  9. <link rel="stylesheet" type="text/css" href="../../css/dataTables.responsive.css">
  10. <link rel="stylesheet" type="text/css" href="../../../../examples/resources/syntax/shCore.css">
  11. <link rel="stylesheet" type="text/css" href="../../../../examples/resources/demo.css">
  12. <style type="text/css" class="init">
  13. </style>
  14. <script type="text/javascript" language="javascript" src="../../../../media/js/jquery.js"></script>
  15. <script type="text/javascript" language="javascript" src="../../../../media/js/jquery.dataTables.js"></script>
  16. <script type="text/javascript" language="javascript" src="../../js/dataTables.responsive.js"></script>
  17. <script type="text/javascript" language="javascript" src="../../../../examples/resources/syntax/shCore.js"></script>
  18. <script type="text/javascript" language="javascript" src="../../../../examples/resources/demo.js"></script>
  19. <script type="text/javascript" language="javascript" class="init">
  20. $(document).ready(function() {
  21. $('#example').DataTable( {
  22. "ajax": "../../../../examples/ajax/data/objects.txt",
  23. "columns": [
  24. { "data": "name", className: "all" },
  25. { "data": "position", className: "min-phone-l" },
  26. { "data": "office", className: "min-tablet" },
  27. { "data": "age", className: "min-tablet" },
  28. { "data": "start_date", className: "never" },
  29. { "data": "salary", className: "desktop" },
  30. { "data": "extn", className: "none" }
  31. ]
  32. } );
  33. } );
  34. </script>
  35. </head>
  36. <body class="dt-example">
  37. <div class="container">
  38. <section>
  39. <h1>Responsive example <span>Assigned class control</span></h1>
  40. <div class="info">
  41. <p>This example exactly matches the functionality of the <a href="classes.xml">class control example</a> but in this case the classes are assigned using the
  42. <a href="//datatables.net/reference/option/columns.className"><code class="option" title=
  43. "DataTables initialisation option">columns.className<span>DT</span></code></a> option.</p>
  44. </div>
  45. <div id="breakpoint"></div>
  46. <table id="example" class="display responsive" width="100%">
  47. <thead>
  48. <tr>
  49. <th>Name</th>
  50. <th>Position</th>
  51. <th>Office</th>
  52. <th>Age</th>
  53. <th>Start date</th>
  54. <th>Salary</th>
  55. <th>Extn.</th>
  56. </tr>
  57. </thead>
  58. <tfoot>
  59. <tr>
  60. <th>Name</th>
  61. <th>Position</th>
  62. <th>Office</th>
  63. <th>Age</th>
  64. <th>Start date</th>
  65. <th>Salary</th>
  66. <th>Extn.</th>
  67. </tr>
  68. </tfoot>
  69. </table>
  70. <ul class="tabs">
  71. <li class="active">Javascript</li>
  72. <li>HTML</li>
  73. <li>CSS</li>
  74. <li>Ajax</li>
  75. <li>Server-side script</li>
  76. </ul>
  77. <div class="tabs">
  78. <div class="js">
  79. <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() {
  80. $('#example').DataTable( {
  81. &quot;ajax&quot;: &quot;../../../../examples/ajax/data/objects.txt&quot;,
  82. &quot;columns&quot;: [
  83. { &quot;data&quot;: &quot;name&quot;, className: &quot;all&quot; },
  84. { &quot;data&quot;: &quot;position&quot;, className: &quot;min-phone-l&quot; },
  85. { &quot;data&quot;: &quot;office&quot;, className: &quot;min-tablet&quot; },
  86. { &quot;data&quot;: &quot;age&quot;, className: &quot;min-tablet&quot; },
  87. { &quot;data&quot;: &quot;start_date&quot;, className: &quot;never&quot; },
  88. { &quot;data&quot;: &quot;salary&quot;, className: &quot;desktop&quot; },
  89. { &quot;data&quot;: &quot;extn&quot;, className: &quot;none&quot; }
  90. ]
  91. } );
  92. } );</code>
  93. <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p>
  94. <ul>
  95. <li><a href="../../../../media/js/jquery.js">../../../../media/js/jquery.js</a></li>
  96. <li><a href="../../../../media/js/jquery.dataTables.js">../../../../media/js/jquery.dataTables.js</a></li>
  97. <li><a href="../../js/dataTables.responsive.js">../../js/dataTables.responsive.js</a></li>
  98. </ul>
  99. </div>
  100. <div class="table">
  101. <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p>
  102. </div>
  103. <div class="css">
  104. <div>
  105. <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
  106. additional CSS used is shown below:</p><code class="multiline language-css"></code>
  107. </div>
  108. <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p>
  109. <ul>
  110. <li><a href="../../../../media/css/jquery.dataTables.css">../../../../media/css/jquery.dataTables.css</a></li>
  111. <li><a href="../../css/dataTables.responsive.css">../../css/dataTables.responsive.css</a></li>
  112. </ul>
  113. </div>
  114. <div class="ajax">
  115. <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
  116. loaded.</p>
  117. </div>
  118. <div class="php">
  119. <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
  120. processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables
  121. documentation</a>.</p>
  122. </div>
  123. </div>
  124. </section>
  125. </div>
  126. <section>
  127. <div class="footer">
  128. <div class="gradient"></div>
  129. <div class="liner">
  130. <h2>Other examples</h2>
  131. <div class="toc">
  132. <div class="toc-group">
  133. <h3><a href="../initialisation/index.html">Basic initialisation</a></h3>
  134. <ul class="toc">
  135. <li><a href="../initialisation/className.html">Class name</a></li>
  136. <li><a href="../initialisation/option.html">Configuration option</a></li>
  137. <li><a href="../initialisation/new.html">`new` constructor</a></li>
  138. <li><a href="../initialisation/ajax.html">Ajax data</a></li>
  139. <li><a href="../initialisation/default.html">Default initialisation</a></li>
  140. </ul>
  141. </div>
  142. <div class="toc-group">
  143. <h3><a href="../styling/index.html">Styling</a></h3>
  144. <ul class="toc">
  145. <li><a href="../styling/bootstrap.html">Bootstrap styling</a></li>
  146. <li><a href="../styling/foundation.html">Foundation styling</a></li>
  147. <li><a href="../styling/scrolling.html">Vertical scrolling</a></li>
  148. <li><a href="../styling/compact.html">Compact styling</a></li>
  149. </ul>
  150. </div>
  151. <div class="toc-group">
  152. <h3><a href="./index.html">Display control</a></h3>
  153. <ul class="toc active">
  154. <li><a href="./auto.html">Automatic column hiding</a></li>
  155. <li><a href="./classes.html">Class control</a></li>
  156. <li class="active"><a href="./init-classes.html">Assigned class control</a></li>
  157. <li><a href="./fixedHeader.html">With FixedHeader</a></li>
  158. <li><a href="./complexHeader.html">Complex headers (rowspan / colspan)</a></li>
  159. </ul>
  160. </div>
  161. <div class="toc-group">
  162. <h3><a href="../child-rows/index.html">Child rows</a></h3>
  163. <ul class="toc">
  164. <li><a href="../child-rows/disable-child-rows.html">Disable child rows</a></li>
  165. <li><a href="../child-rows/column-control.html">Column controlled child rows</a></li>
  166. <li><a href="../child-rows/right-column.html">Column control - right</a></li>
  167. <li><a href="../child-rows/whole-row-control.html">Whole row child row control</a></li>
  168. <li><a href="../child-rows/custom-renderer.html">Custom child row renderer</a></li>
  169. </ul>
  170. </div>
  171. </div>
  172. <div class="epilogue">
  173. <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br>
  174. 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>
  175. which extend the capabilities of DataTables.</p>
  176. <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2015<br>
  177. DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
  178. </div>
  179. </div>
  180. </div>
  181. </section>
  182. </body>
  183. </html>