0
|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
2 <html>
|
|
3 <head>
|
|
4 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
5 <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
|
|
6
|
|
7 <title>DataTables example</title>
|
|
8 <style type="text/css" title="currentStyle">
|
|
9 @import "../../media/css/demo_page.css";
|
|
10 @import "../../media/css/demo_table.css";
|
|
11 </style>
|
|
12 <script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
|
|
13 <script type="text/javascript" language="javascript" src="../examples_support/jquery.jeditable.js"></script>
|
|
14 <script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
|
15 <script type="text/javascript" charset="utf-8">
|
|
16 $(document).ready(function() {
|
|
17 var oTable = $('#example').dataTable( {
|
|
18 "bProcessing": true,
|
|
19 "bServerSide": true,
|
|
20 "sAjaxSource": "scripts/server_processing.php",
|
|
21 "fnDrawCallback": function () {
|
|
22 $('#example tbody td').editable( '../examples_support/editable_ajax.php', {
|
|
23 "callback": function( sValue, y ) {
|
|
24 /* Redraw the table from the new data on the server */
|
|
25 oTable.fnDraw();
|
|
26 },
|
|
27 "height": "14px"
|
|
28 } );
|
|
29 }
|
|
30 } );
|
|
31 } );
|
|
32 </script>
|
|
33 </head>
|
|
34 <body id="dt_example">
|
|
35 <div id="container">
|
|
36 <div class="full_width big">
|
|
37 DataTables server-side processing example
|
|
38 </div>
|
|
39
|
|
40 <h1>Preamble</h1>
|
|
41 <p>When using server-side processing and you wish to integrate the <a href="http://www.appelsiini.net/projects/jeditable">jEditable plug-in for jQuery</a> with DataTables, you need to consider that each time data is returned from the server, DataTables will build new DOM elements - so these need the jEditable event handlers applied to them. This is down through use of the fnDrawCallback function.</p>
|
|
42 <p>If you are interested in a full <a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete">CRUD</a> implementation for DataTables, check out the <a href="http://editor.datatables.net">Editor plug-in for DataTables</a>, which provides a flexible and easy to use create, edit and delete environment for DataTables controlled tables with full server interaction.</p>
|
|
43
|
|
44 <h1>Live example</h1>
|
|
45 <div id="dynamic">
|
|
46 <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
|
47 <thead>
|
|
48 <tr>
|
|
49 <th width="20%">Rendering engine</th>
|
|
50 <th width="25%">Browser</th>
|
|
51 <th width="25%">Platform(s)</th>
|
|
52 <th width="15%">Engine version</th>
|
|
53 <th width="15%">CSS grade</th>
|
|
54 </tr>
|
|
55 </thead>
|
|
56 <tbody>
|
|
57 <tr>
|
|
58 <td colspan="5" class="dataTables_empty">Loading data from server</td>
|
|
59 </tr>
|
|
60 </tbody>
|
|
61 <tfoot>
|
|
62 <tr>
|
|
63 <th>Rendering engine</th>
|
|
64 <th>Browser</th>
|
|
65 <th>Platform(s)</th>
|
|
66 <th>Engine version</th>
|
|
67 <th>CSS grade</th>
|
|
68 </tr>
|
|
69 </tfoot>
|
|
70 </table>
|
|
71 </div>
|
|
72 <div class="spacer"></div>
|
|
73
|
|
74
|
|
75 <h1>Initialisation code</h1>
|
|
76 <pre class="brush: js;">$(document).ready(function() {
|
|
77 var oTable = $('#example').dataTable( {
|
|
78 "bProcessing": true,
|
|
79 "bServerSide": true,
|
|
80 "sAjaxSource": "scripts/server_processing.php",
|
|
81 "fnDrawCallback": function () {
|
|
82 $('#example tbody td').editable( '../examples_support/editable_ajax.php', {
|
|
83 "callback": function( sValue, y ) {
|
|
84 /* Redraw the table from the new data on the server */
|
|
85 oTable.fnDraw();
|
|
86 },
|
|
87 "height": "14px"
|
|
88 } );
|
|
89 }
|
|
90 } );
|
|
91 } );</pre>
|
|
92 <style type="text/css">
|
|
93 @import "../examples_support/syntax/css/shCore.css";
|
|
94 </style>
|
|
95 <script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
|
|
96
|
|
97 <h1>Server response</h1>
|
|
98 <p>The code below shows the latest JSON data that has been returned from the server in response to the Ajax request made by DataTables. This will update as further requests are made.</p>
|
|
99 <pre id="latest_xhr" class="brush: js;"></pre>
|
|
100
|
|
101
|
|
102 <h1>Other examples</h1>
|
|
103 <div class="demo_links">
|
|
104 <h2>Basic initialisation</h2>
|
|
105 <ul>
|
|
106 <li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
|
|
107 <li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
|
|
108 <li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
|
|
109 <li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
|
|
110 <li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
|
|
111 <li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
|
|
112 <li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
|
|
113 <li><a href="../basic_init/dom.html">DOM positioning</a></li>
|
|
114 <li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
|
|
115 <li><a href="../basic_init/state_save.html">State saving</a></li>
|
|
116 <li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
|
|
117 <li>Scrolling: <br>
|
|
118 <a href="../basic_init/scroll_x.html">Horizontal</a> /
|
|
119 <a href="../basic_init/scroll_y.html">Vertical</a> /
|
|
120 <a href="../basic_init/scroll_xy.html">Both</a> /
|
|
121 <a href="../basic_init/scroll_y_theme.html">Themed</a> /
|
|
122 <a href="../basic_init/scroll_y_infinite.html">Infinite</a>
|
|
123 </li>
|
|
124 <li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
|
|
125 <li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
|
|
126 </ul>
|
|
127
|
|
128 <h2>Advanced initialisation</h2>
|
|
129 <ul>
|
|
130 <li>Events: <br>
|
|
131 <a href="../advanced_init/events_live.html">Live events</a> /
|
|
132 <a href="../advanced_init/events_pre_init.html">Pre-init</a> /
|
|
133 <a href="../advanced_init/events_post_init.html">Post-init</a>
|
|
134 </li>
|
|
135 <li><a href="../advanced_init/column_render.html">Column rendering</a></li>
|
|
136 <li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
|
|
137 <li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
|
|
138 <li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
|
|
139 <li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
|
|
140 <li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
|
|
141 <li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
|
|
142 <li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
|
|
143 <li><a href="../advanced_init/row_callback.html">Row callback</a></li>
|
|
144 <li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
|
|
145 <li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
|
|
146 <li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
|
|
147 <li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
|
|
148 <li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
|
|
149 <li><a href="../advanced_init/dt_events.html">Custom events</a></li>
|
|
150 </ul>
|
|
151
|
|
152 <h2>API</h2>
|
|
153 <ul>
|
|
154 <li><a href="../api/add_row.html">Dynamically add a new row</a></li>
|
|
155 <li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
|
|
156 <li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
|
|
157 <li><a href="../api/highlight.html">Highlight rows and columns</a></li>
|
|
158 <li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
|
|
159 <li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
|
|
160 <li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
|
|
161 <li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
|
|
162 <li><a href="../api/form.html">Submit form with elements in table</a></li>
|
|
163 <li><a href="../api/counter_column.html">Index column (static number column)</a></li>
|
|
164 <li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
|
|
165 <li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
|
|
166 <li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
|
|
167 <li><a href="../api/regex.html">Regular expression filtering</a></li>
|
|
168 </ul>
|
|
169 </div>
|
|
170
|
|
171 <div class="demo_links">
|
|
172 <h2>Data sources</h2>
|
|
173 <ul>
|
|
174 <li><a href="../data_sources/dom.html">DOM</a></li>
|
|
175 <li><a href="../data_sources/js_array.html">Javascript array</a></li>
|
|
176 <li><a href="../data_sources/ajax.html">Ajax source</a></li>
|
|
177 <li><a href="../data_sources/server_side.html">Server side processing</a></li>
|
|
178 </ul>
|
|
179
|
|
180 <h2>Server-side processing</h2>
|
|
181 <ul>
|
|
182 <li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
|
|
183 <li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
|
|
184 <li><a href="../server_side/post.html">Use HTTP POST</a></li>
|
|
185 <li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
|
|
186 <li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
|
|
187 <li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
|
|
188 <li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
|
|
189 <li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
|
|
190 <li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
|
|
191 <li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
|
|
192 <li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
|
|
193 </ul>
|
|
194
|
|
195 <h2>Ajax data source</h2>
|
|
196 <ul>
|
|
197 <li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
|
|
198 <li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
|
|
199 <li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
|
|
200 <li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
|
|
201 <li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
|
|
202 <li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
|
|
203 <li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
|
|
204 </ul>
|
|
205
|
|
206 <h2>Plug-ins</h2>
|
|
207 <ul>
|
|
208 <li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
|
|
209 <li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
|
|
210 <li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
|
|
211 <li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
|
|
212 <li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
|
|
213 <li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
|
|
214 <li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
|
|
215 </ul>
|
|
216 </div>
|
|
217
|
|
218
|
|
219 <div id="footer" class="clear" style="text-align:center;">
|
|
220 <p>
|
|
221 Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
|
|
222 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> which extend the capabilities of DataTables.
|
|
223 </p>
|
|
224
|
|
225 <span style="font-size:10px;">
|
|
226 DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
|
|
227 DataTables is dual licensed under the <a href="http://www.datatables.net/license_gpl2">GPL v2 license</a> or a <a href="http://www.datatables.net/license_bsd">BSD (3-point) license</a>.
|
|
228 </span>
|
|
229 </div>
|
|
230 </div>
|
|
231 </body>
|
|
232 </html> |