init-classes.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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": "extn", className="min-tablet" },
  28. { "data": "start_date", className="desktop" },
  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
  42. example</a> but in this case the classes are assigned using the <a href=
  43. "//datatables.net/reference/option/columns.className"><code class="option" title=
  44. "DataTables initialisation option">columns.className<span>DT</span></code></a> option.</p>
  45. </div>
  46. <div id="breakpoint"></div>
  47. <table id="example" class="display responsive" width="100%">
  48. <thead>
  49. <tr>
  50. <th>Name</th>
  51. <th>Position</th>
  52. <th>Office</th>
  53. <th>Age</th>
  54. <th>Start date</th>
  55. <th>Salary</th>
  56. <th>Extn.</th>
  57. </tr>
  58. </thead>
  59. <tfoot>
  60. <tr>
  61. <th>Name</th>
  62. <th>Position</th>
  63. <th>Office</th>
  64. <th>Age</th>
  65. <th>Start date</th>
  66. <th>Salary</th>
  67. <th>Extn.</th>
  68. </tr>
  69. </tfoot>
  70. </table>
  71. <ul class="tabs">
  72. <li class="active">Javascript</li>
  73. <li>HTML</li>
  74. <li>CSS</li>
  75. <li>Ajax</li>
  76. <li>Server-side script</li>
  77. </ul>
  78. <div class="tabs">
  79. <div class="js">
  80. <p>The Javascript shown below is used to initialise the table shown in this
  81. example:</p><code class="multiline brush: js;">$(document).ready(function() {
  82. $('#example').DataTable( {
  83. &quot;ajax&quot;: &quot;../../../../examples/ajax/data/objects.txt&quot;,
  84. &quot;columns&quot;: [
  85. { &quot;data&quot;: &quot;name&quot;, className=&quot;all&quot; },
  86. { &quot;data&quot;: &quot;position&quot;, className=&quot;min-phone-l&quot; },
  87. { &quot;data&quot;: &quot;office&quot;, className=&quot;min-tablet&quot; },
  88. { &quot;data&quot;: &quot;extn&quot;, className=&quot;min-tablet&quot; },
  89. { &quot;data&quot;: &quot;start_date&quot;, className=&quot;desktop&quot; },
  90. { &quot;data&quot;: &quot;salary&quot;, className=&quot;desktop&quot; },
  91. { &quot;data&quot;: &quot;extn&quot;, className=&quot;none&quot; }
  92. ]
  93. } );
  94. } );</code>
  95. <p>In addition to the above code, the following Javascript library files are loaded for use in this
  96. example:</p>
  97. <ul>
  98. <li><a href="../../../../media/js/jquery.js">../../../../media/js/jquery.js</a></li>
  99. <li><a href=
  100. "../../../../media/js/jquery.dataTables.js">../../../../media/js/jquery.dataTables.js</a></li>
  101. <li><a href="../../js/dataTables.responsive.js">../../js/dataTables.responsive.js</a></li>
  102. </ul>
  103. </div>
  104. <div class="table">
  105. <p>The HTML shown below is the raw HTML table element, before it has been enhanced by
  106. DataTables:</p>
  107. </div>
  108. <div class="css">
  109. <div>
  110. <p>This example uses a little bit of additional CSS beyond what is loaded from the library
  111. files (below), in order to correctly display the table. The additional CSS used is shown
  112. below:</p><code class="multiline brush: js;"></code>
  113. </div>
  114. <p>The following CSS library files are loaded for use in this example to provide the styling of the
  115. table:</p>
  116. <ul>
  117. <li><a href=
  118. "../../../../media/css/jquery.dataTables.css">../../../../media/css/jquery.dataTables.css</a></li>
  119. <li><a href="../../css/dataTables.responsive.css">../../css/dataTables.responsive.css</a></li>
  120. </ul>
  121. </div>
  122. <div class="ajax">
  123. <p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data
  124. will update automatically as any additional data is loaded.</p>
  125. </div>
  126. <div class="php">
  127. <p>The script used to perform the server-side processing for this table is shown below. Please note
  128. that this is just an example script using PHP. Server-side processing scripts can be written in any
  129. language, using <a href="//datatables.net/manual/server-side">the protocol described in the
  130. DataTables documentation</a>.</p>
  131. </div>
  132. </div>
  133. </section>
  134. </div>
  135. <section>
  136. <div class="footer">
  137. <div class="gradient"></div>
  138. <div class="liner">
  139. <h2>Other examples</h2>
  140. <div class="toc">
  141. <div class="toc-group">
  142. <h3><a href="../initialisation/index.html">Basic initialisation</a></h3>
  143. <ul class="toc">
  144. <li><a href="../initialisation/className.html">Class name</a></li>
  145. <li><a href="../initialisation/option.html">Configuration option</a></li>
  146. <li><a href="../initialisation/new.html">`new` constructor</a></li>
  147. <li><a href="../initialisation/ajax.html">Ajax data</a></li>
  148. </ul>
  149. </div>
  150. <div class="toc-group">
  151. <h3><a href="../styling/index.html">Styling</a></h3>
  152. <ul class="toc">
  153. <li><a href="../styling/bootstrap.html">Bootstrap styling</a></li>
  154. <li><a href="../styling/foundation.html">Foundation styling</a></li>
  155. </ul>
  156. </div>
  157. <div class="toc-group">
  158. <h3><a href="./index.html">Display control</a></h3>
  159. <ul class="toc active">
  160. <li><a href="./auto.html">Automatic column hiding</a></li>
  161. <li><a href="./classes.html">Class control</a></li>
  162. <li class="active"><a href="./init-classes.html">Assigned class control</a></li>
  163. </ul>
  164. </div>
  165. <div class="toc-group">
  166. <h3><a href="../child-rows/index.html">Child rows</a></h3>
  167. <ul class="toc">
  168. <li><a href="../child-rows/disable-child-rows.html">Disable child rows</a></li>
  169. <li><a href="../child-rows/column-control.html">Column controlled child rows</a></li>
  170. <li><a href="../child-rows/right-column.html">Column control - right</a></li>
  171. <li><a href="../child-rows/whole-row-control.html">Whole row child row control</a></li>
  172. <li><a href="../child-rows/custom-renderer.html">Custom child row renderer</a></li>
  173. </ul>
  174. </div>
  175. </div>
  176. <div class="epilogue">
  177. <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
  178. information about its API properties and methods.<br>
  179. Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
  180. <a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
  181. DataTables.</p>
  182. <p class="copyright">DataTables designed and created by <a href=
  183. "http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2014<br>
  184. DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
  185. </div>
  186. </div>
  187. </div>
  188. </section>
  189. </body>
  190. </html>