1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv="content-type" content="text/html; charset=utf-8">
5 <link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico">
7 <title>ColReorder example</title>
8 <style type="text/css" title="currentStyle">
9 @import "../../media/css/demo_page.css";
10 @import "../../media/css/demo_table.css";
11 @import "media/css/ColReorder.css";
13 <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script>
14 <script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script>
15 <script type="text/javascript" charset="utf-8" src="media/js/ColReorder.js"></script>
16 <script type="text/javascript" charset="utf-8">
17 $(document).ready( function () {
18 var oTable = $('#example').dataTable( {
22 "sAjaxSource": "../../examples/server_side/scripts/objects.php",
24 { "mDataProp": "engine" },
25 { "mDataProp": "browser" },
26 { "mDataProp": "platform" },
27 { "mDataProp": "version" },
28 { "mDataProp": "grade" }
34 <body id="dt_example">
36 <div class="full_width big">
37 ColReorder example with server-side processing
41 <p>Server-side processing can be exceptionally useful in DataTables when dealing with
42 massive data sets, and ColReorder works with this as would be expected. There must be
43 special consideration for the column ordering on the server-side script since the
44 columns can be in an unexpected order. For this you can either choose to use the
45 <i>sName</i> parameter for each column and take this into account in the server-side
46 script (the parameter 'sColumns' is a comma separated string of these sName parameters).</p>
48 </p>Alternatively use the more flexible <a href="http://datatables.net/usage/columns#mDataProp">mDataProp</a>
49 option for each column. This allows you to use JSON objects which DataTables, so order doesn't
50 matter like it would do in an array. Again the server-side script must take this into account
51 through the <i>mDataProp_{i}</i> which is sent for each column (so the server knows which
52 column is to be sorted on).</p>
58 <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
61 <th>Rendering engine</th>
64 <th>Engine version</th>
70 <th>Rendering engine</th>
73 <th>Engine version</th>
82 <div class="spacer"></div>
87 <li><a href="index.html">Basic initialisation</a></li>
88 <li><a href="alt_insert.html">Styling the insert cursor</a></li>
89 <li><a href="col_filter.html">Individual column filtering</a></li>
90 <li><a href="colvis.html">Integration with DataTables' ColVis plug-in</a></li>
91 <li><a href="fixedcolumns.html">Integration with DataTables' FixedColumns plug-in</a></li>
92 <li><a href="fixedheader.html">Integration with DataTables' FixedHeader plug-in</a></li>
93 <li><a href="predefined.html">Using a predefined column order set</a></li>
94 <li><a href="reset.html">Providing a user control to reset the column order</a></li>
95 <li><a href="scrolling.html">Column reordering shown with scrolling in DataTables</a></li>
96 <li><a href="server_side.html">Server-side processing support</a></li>
97 <li><a href="state_save.html">State saving of the column position</a></li>
98 <li><a href="theme.html">jQuery UI theme integration</a></li>
102 <h1>Initialisation code</h1>
103 <pre>$(document).ready( function () {
104 var oTable = $('#example').dataTable( {
108 "sAjaxSource": "../../examples/server_side/scripts/objects.php",
110 { "mDataProp": "engine" },
111 { "mDataProp": "browser" },
112 { "mDataProp": "platform" },
113 { "mDataProp": "version" },
114 { "mDataProp": "grade" }
119 <h1>Example JSON return from the server</h1>
122 "iTotalRecords": "57",
123 "iTotalDisplayRecords": "57",
127 "browser": "Firefox 1.0",
128 "platform": "Win 98+ / OSX.2+",
134 "browser": "Firefox 1.5",
135 "platform": "Win 98+ / OSX.2+",
143 <div id="footer" style="text-align:center;">
144 <span style="font-size:10px;">
145 ColReorder and DataTables © Allan Jardine 2010