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>ColReorder example - State saving</title>
9 <link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
10 <link rel="stylesheet" type="text/css" href="../css/dataTables.colReorder.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.colReorder.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( {
37 <body class="dt-example">
38 <div class="container">
40 <h1>ColReorder example <span>State saving</span></h1>
43 <p>A useful interaction pattern to use in DataTables is state saving, so when the end user reloads or revisits a page its previous state is retained. ColReorder
44 works seamlessly with state saving in DataTables (<a href="//datatables.net/reference/option/stateSave"><code class="option" title=
45 "DataTables initialisation option">stateSave<span>DT</span></code></a>), remembering and restoring the column positions, as well as everything else such as sorting
49 <table id="example" class="display" cellspacing="0" width="100%">
75 <td>System Architect</td>
82 <td>Garrett Winters</td>
91 <td>Junior Technical Author</td>
92 <td>San Francisco</td>
99 <td>Senior Javascript Developer</td>
114 <td>Brielle Williamson</td>
115 <td>Integration Specialist</td>
122 <td>Herrod Chandler</td>
123 <td>Sales Assistant</td>
124 <td>San Francisco</td>
130 <td>Rhona Davidson</td>
131 <td>Integration Specialist</td>
138 <td>Colleen Hurst</td>
139 <td>Javascript Developer</td>
140 <td>San Francisco</td>
147 <td>Software Engineer</td>
155 <td>Office Manager</td>
163 <td>Support Lead</td>
170 <td>Charde Marshall</td>
171 <td>Regional Director</td>
172 <td>San Francisco</td>
178 <td>Haley Kennedy</td>
179 <td>Senior Marketing Designer</td>
186 <td>Tatyana Fitzpatrick</td>
187 <td>Regional Director</td>
194 <td>Michael Silva</td>
195 <td>Marketing Designer</td>
203 <td>Chief Financial Officer (CFO)</td>
210 <td>Gloria Little</td>
211 <td>Systems Administrator</td>
218 <td>Bradley Greer</td>
219 <td>Software Engineer</td>
227 <td>Personnel Lead</td>
234 <td>Jenette Caldwell</td>
235 <td>Development Lead</td>
243 <td>Chief Marketing Officer (CMO)</td>
250 <td>Caesar Vance</td>
251 <td>Pre-Sales Support</td>
258 <td>Doris Wilder</td>
259 <td>Sales Assistant</td>
266 <td>Angelica Ramos</td>
267 <td>Chief Executive Officer (CEO)</td>
282 <td>Jennifer Chang</td>
283 <td>Regional Director</td>
290 <td>Brenden Wagner</td>
291 <td>Software Engineer</td>
292 <td>San Francisco</td>
299 <td>Chief Operating Officer (COO)</td>
300 <td>San Francisco</td>
307 <td>Regional Marketing</td>
314 <td>Michelle House</td>
315 <td>Integration Specialist</td>
330 <td>Prescott Bartlett</td>
331 <td>Technical Author</td>
338 <td>Gavin Cortez</td>
340 <td>San Francisco</td>
346 <td>Martena Mccray</td>
347 <td>Post-Sales support</td>
354 <td>Unity Butler</td>
355 <td>Marketing Designer</td>
356 <td>San Francisco</td>
362 <td>Howard Hatfield</td>
363 <td>Office Manager</td>
364 <td>San Francisco</td>
370 <td>Hope Fuentes</td>
372 <td>San Francisco</td>
378 <td>Vivian Harrell</td>
379 <td>Financial Controller</td>
380 <td>San Francisco</td>
386 <td>Timothy Mooney</td>
387 <td>Office Manager</td>
394 <td>Jackson Bradshaw</td>
402 <td>Olivia Liang</td>
403 <td>Support Engineer</td>
411 <td>Software Engineer</td>
418 <td>Sakura Yamamoto</td>
419 <td>Support Engineer</td>
434 <td>Finn Camacho</td>
435 <td>Support Engineer</td>
436 <td>San Francisco</td>
442 <td>Serge Baldwin</td>
443 <td>Data Coordinator</td>
450 <td>Zenaida Frank</td>
451 <td>Software Engineer</td>
458 <td>Zorita Serrano</td>
459 <td>Software Engineer</td>
460 <td>San Francisco</td>
466 <td>Jennifer Acosta</td>
467 <td>Junior Javascript Developer</td>
474 <td>Cara Stevens</td>
475 <td>Sales Assistant</td>
482 <td>Hermione Butler</td>
483 <td>Regional Director</td>
491 <td>Systems Administrator</td>
498 <td>Jonas Alexander</td>
500 <td>San Francisco</td>
507 <td>Regional Director</td>
514 <td>Michael Bruce</td>
515 <td>Javascript Developer</td>
522 <td>Donna Snider</td>
523 <td>Customer Support</td>
533 <li class="active">Javascript</li>
537 <li>Server-side script</li>
542 <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() {
543 $('#example').dataTable( {
549 <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p>
552 <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
553 <li><a href="../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
554 <li><a href="../js/dataTables.colReorder.js">../js/dataTables.colReorder.js</a></li>
559 <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p>
564 <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
565 additional CSS used is shown below:</p><code class="multiline language-css"></code>
568 <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p>
571 <li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
572 <li><a href="../css/dataTables.colReorder.css">../css/dataTables.colReorder.css</a></li>
577 <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
582 <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
583 processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables
584 documentation</a>.</p>
592 <div class="gradient"></div>
595 <h2>Other examples</h2>
598 <div class="toc-group">
599 <h3><a href="./index.html">Examples</a></h3>
600 <ul class="toc active">
601 <li><a href="./simple.html">Basic initialisation</a></li>
602 <li><a href="./new_init.html">Initialisation using `new`</a></li>
603 <li><a href="./alt_insert.html">Alternative insert styling</a></li>
604 <li><a href="./realtime.html">Realtime updating</a></li>
605 <li class="active"><a href="./state_save.html">State saving</a></li>
606 <li><a href="./scrolling.html">Scrolling table</a></li>
607 <li><a href="./predefined.html">Predefined column ordering</a></li>
608 <li><a href="./reset.html">Reset ordering API</a></li>
609 <li><a href="./colvis.html">ColVis integration</a></li>
610 <li><a href="./fixedcolumns.html">FixedColumns integration</a></li>
611 <li><a href="./fixedheader.html">FixedHeader integration</a></li>
612 <li><a href="./jqueryui.html">jQuery UI styling</a></li>
613 <li><a href="./col_filter.html">Individual column filtering</a></li>
614 <li><a href="./server_side.html">Server-side processing</a></li>
619 <div class="epilogue">
620 <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br>
621 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>
622 which extend the capabilities of DataTables.</p>
624 <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2015<br>
625 DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>