First Initial
This commit is contained in:
@@ -0,0 +1,218 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
|
||||
|
||||
<title>DataTables example</title>
|
||||
<style type="text/css" title="currentStyle">
|
||||
@import "../../media/css/demo_page.css";
|
||||
@import "../../media/css/demo_table.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/server_processing.php",
|
||||
"fnServerParams": function ( aoData ) {
|
||||
aoData.push( { "name": "more_data", "value": "my_value" } );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body id="dt_example">
|
||||
<div id="container">
|
||||
<div class="full_width big">
|
||||
DataTables server-side processing example
|
||||
</div>
|
||||
|
||||
<h1>Preamble</h1>
|
||||
<p>It can often be useful to send a little bit of extra information to the server when utilising DataTables' server-side processing option. This can be done by using the <a href="http://datatables.net/ref#fnServerParams">fnServerParams</a> callback function which is called whenever an XHR is sent to the server. fnServerParams Takes a single parameter, the array of name/value pairs of parameters that are to be sent to the server. You can manipulate this as you require - typically adding another parameter, as shown in this example.</p>
|
||||
|
||||
<h1>Live example</h1>
|
||||
<div id="dynamic">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">Rendering engine</th>
|
||||
<th width="25%">Browser</th>
|
||||
<th width="25%">Platform(s)</th>
|
||||
<th width="15%">Engine version</th>
|
||||
<th width="15%">CSS grade</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="5" class="dataTables_empty">Loading data from server</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Rendering engine</th>
|
||||
<th>Browser</th>
|
||||
<th>Platform(s)</th>
|
||||
<th>Engine version</th>
|
||||
<th>CSS grade</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
|
||||
|
||||
<h1>Initialisation code</h1>
|
||||
<pre class="brush: js;">$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/server_processing.php"
|
||||
"fnServerParams": function ( aoData ) {
|
||||
aoData.push( { "name": "more_data", "value": "my_value" } );
|
||||
}
|
||||
} );
|
||||
} );</pre>
|
||||
<style type="text/css">
|
||||
@import "../examples_support/syntax/css/shCore.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
|
||||
|
||||
<h1>Server response</h1>
|
||||
<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>
|
||||
<pre id="latest_xhr" class="brush: js;"></pre>
|
||||
|
||||
|
||||
<h1>Other examples</h1>
|
||||
<div class="demo_links">
|
||||
<h2>Basic initialisation</h2>
|
||||
<ul>
|
||||
<li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
|
||||
<li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
|
||||
<li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
|
||||
<li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
|
||||
<li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
|
||||
<li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
|
||||
<li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
|
||||
<li><a href="../basic_init/dom.html">DOM positioning</a></li>
|
||||
<li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
|
||||
<li><a href="../basic_init/state_save.html">State saving</a></li>
|
||||
<li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
|
||||
<li>Scrolling: <br>
|
||||
<a href="../basic_init/scroll_x.html">Horizontal</a> /
|
||||
<a href="../basic_init/scroll_y.html">Vertical</a> /
|
||||
<a href="../basic_init/scroll_xy.html">Both</a> /
|
||||
<a href="../basic_init/scroll_y_theme.html">Themed</a> /
|
||||
<a href="../basic_init/scroll_y_infinite.html">Infinite</a>
|
||||
</li>
|
||||
<li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
|
||||
<li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Advanced initialisation</h2>
|
||||
<ul>
|
||||
<li>Events: <br>
|
||||
<a href="../advanced_init/events_live.html">Live events</a> /
|
||||
<a href="../advanced_init/events_pre_init.html">Pre-init</a> /
|
||||
<a href="../advanced_init/events_post_init.html">Post-init</a>
|
||||
</li>
|
||||
<li><a href="../advanced_init/column_render.html">Column rendering</a></li>
|
||||
<li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
|
||||
<li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
|
||||
<li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
|
||||
<li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
|
||||
<li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
|
||||
<li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
|
||||
<li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
|
||||
<li><a href="../advanced_init/row_callback.html">Row callback</a></li>
|
||||
<li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
|
||||
<li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
|
||||
<li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
|
||||
<li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
|
||||
<li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
|
||||
<li><a href="../advanced_init/dt_events.html">Custom events</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>API</h2>
|
||||
<ul>
|
||||
<li><a href="../api/add_row.html">Dynamically add a new row</a></li>
|
||||
<li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
|
||||
<li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
|
||||
<li><a href="../api/highlight.html">Highlight rows and columns</a></li>
|
||||
<li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
|
||||
<li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
|
||||
<li><a href="../api/form.html">Submit form with elements in table</a></li>
|
||||
<li><a href="../api/counter_column.html">Index column (static number column)</a></li>
|
||||
<li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
|
||||
<li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
|
||||
<li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
|
||||
<li><a href="../api/regex.html">Regular expression filtering</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="demo_links">
|
||||
<h2>Data sources</h2>
|
||||
<ul>
|
||||
<li><a href="../data_sources/dom.html">DOM</a></li>
|
||||
<li><a href="../data_sources/js_array.html">Javascript array</a></li>
|
||||
<li><a href="../data_sources/ajax.html">Ajax source</a></li>
|
||||
<li><a href="../data_sources/server_side.html">Server side processing</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Server-side processing</h2>
|
||||
<ul>
|
||||
<li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
|
||||
<li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
|
||||
<li><a href="../server_side/post.html">Use HTTP POST</a></li>
|
||||
<li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
|
||||
<li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
|
||||
<li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
|
||||
<li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
|
||||
<li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
|
||||
<li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Ajax data source</h2>
|
||||
<ul>
|
||||
<li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
|
||||
<li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
|
||||
<li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
|
||||
<li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
|
||||
<li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
|
||||
<li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
|
||||
<li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Plug-ins</h2>
|
||||
<ul>
|
||||
<li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
|
||||
<li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
|
||||
<li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
|
||||
<li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
|
||||
<li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer" class="clear" style="text-align:center;">
|
||||
<p>
|
||||
Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<span style="font-size:10px;">
|
||||
DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
|
||||
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>.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,281 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
|
||||
|
||||
<title>DataTables example</title>
|
||||
<style type="text/css" title="currentStyle">
|
||||
@import "../../media/css/demo_page.css";
|
||||
@import "../../media/css/demo_table.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/server_processing.php",
|
||||
"iDeferLoading": 57
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body id="dt_example">
|
||||
<div id="container">
|
||||
<div class="full_width big">
|
||||
DataTables server-side processing example with deferred loading
|
||||
</div>
|
||||
|
||||
<h1>Preamble</h1>
|
||||
<p>When using DataTables with server-side processing the default behaviour is to have DataTables automatically go the server and load the data, removing anything which might already be on the page. However, this behaviour might not always be desirable when the first page of the table has already been preloaded in the HTML. This is achieved by using the <i>iDeferLoading</i> initialisation property. It serves two purposes, firstly to include that deferred loading is required, but also to tell DataTables how many records there are in the full table, in this case 57 (this allows the information element and pagination to be displayed correctly).</p>
|
||||
|
||||
<p>In this example the preloaded data is hardcoded in, but you could use a PHP include or anything else to put the data in the table for the first page - DataTables won't process it at all, simply display it and be ready to load the next page / search / sort etc.</p>
|
||||
|
||||
<h1>Live example</h1>
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">Rendering engine</th>
|
||||
<th width="25%">Browser</th>
|
||||
<th width="25%">Platform(s)</th>
|
||||
<th width="15%">Engine version</th>
|
||||
<th width="15%">CSS grade</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Gecko</td>
|
||||
<td>Firefox 1.0</td>
|
||||
<td>Win 98+ / OSX.2+</td>
|
||||
<td>1.7</td>
|
||||
<td>A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gecko</td>
|
||||
<td>Firefox 1.5</td>
|
||||
<td>Win 98+ / OSX.2+</td>
|
||||
<td>1.8</td>
|
||||
<td>A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gecko</td>
|
||||
<td>Firefox 2.0</td>
|
||||
<td>Win 98+ / OSX.2+</td>
|
||||
<td>1.8</td>
|
||||
<td>A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gecko</td>
|
||||
<td>Firefox 3.0</td>
|
||||
<td>Win 2k+ / OSX.3+</td>
|
||||
<td>1.9</td>
|
||||
<td>A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gecko</td>
|
||||
<td>Camino 1.0</td>
|
||||
<td>OSX.2+</td>
|
||||
<td>1.8</td>
|
||||
<td>A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gecko</td>
|
||||
<td>Camino 1.5</td>
|
||||
<td>OSX.3+</td>
|
||||
<td>1.8</td>
|
||||
<td>A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gecko</td>
|
||||
<td>Netscape 7.2</td>
|
||||
<td>Win 95+ / Mac OS 8.6-9.2</td>
|
||||
<td>1.7</td>
|
||||
<td>A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gecko</td>
|
||||
<td>Netscape Browser 8</td>
|
||||
<td>Win 98SE+</td>
|
||||
<td>1.7</td>
|
||||
<td>A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gecko</td>
|
||||
<td>Netscape Navigator 9</td>
|
||||
<td>Win 98+ / OSX.2+</td>
|
||||
<td>1.8</td>
|
||||
<td>A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gecko</td>
|
||||
<td>Mozilla 1.0</td>
|
||||
<td>Win 95+ / OSX.1+</td>
|
||||
<td>1</td>
|
||||
<td>A</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Rendering engine</th>
|
||||
<th>Browser</th>
|
||||
<th>Platform(s)</th>
|
||||
<th>Engine version</th>
|
||||
<th>CSS grade</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<div class="spacer"></div>
|
||||
|
||||
|
||||
<h1>Initialisation code</h1>
|
||||
<pre class="brush: js;">$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/server_processing.php",
|
||||
"iDeferLoading": 57
|
||||
} );
|
||||
} );</pre>
|
||||
<style type="text/css">
|
||||
@import "../examples_support/syntax/css/shCore.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
|
||||
|
||||
<h1>Server response</h1>
|
||||
<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>
|
||||
<pre id="latest_xhr" class="brush: js;"></pre>
|
||||
|
||||
|
||||
<h1>Other examples</h1>
|
||||
<div class="demo_links">
|
||||
<h2>Basic initialisation</h2>
|
||||
<ul>
|
||||
<li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
|
||||
<li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
|
||||
<li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
|
||||
<li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
|
||||
<li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
|
||||
<li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
|
||||
<li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
|
||||
<li><a href="../basic_init/dom.html">DOM positioning</a></li>
|
||||
<li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
|
||||
<li><a href="../basic_init/state_save.html">State saving</a></li>
|
||||
<li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
|
||||
<li>Scrolling: <br>
|
||||
<a href="../basic_init/scroll_x.html">Horizontal</a> /
|
||||
<a href="../basic_init/scroll_y.html">Vertical</a> /
|
||||
<a href="../basic_init/scroll_xy.html">Both</a> /
|
||||
<a href="../basic_init/scroll_y_theme.html">Themed</a> /
|
||||
<a href="../basic_init/scroll_y_infinite.html">Infinite</a>
|
||||
</li>
|
||||
<li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
|
||||
<li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Advanced initialisation</h2>
|
||||
<ul>
|
||||
<li>Events: <br>
|
||||
<a href="../advanced_init/events_live.html">Live events</a> /
|
||||
<a href="../advanced_init/events_pre_init.html">Pre-init</a> /
|
||||
<a href="../advanced_init/events_post_init.html">Post-init</a>
|
||||
</li>
|
||||
<li><a href="../advanced_init/column_render.html">Column rendering</a></li>
|
||||
<li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
|
||||
<li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
|
||||
<li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
|
||||
<li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
|
||||
<li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
|
||||
<li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
|
||||
<li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
|
||||
<li><a href="../advanced_init/row_callback.html">Row callback</a></li>
|
||||
<li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
|
||||
<li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
|
||||
<li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
|
||||
<li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
|
||||
<li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
|
||||
<li><a href="../advanced_init/dt_events.html">Custom events</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>API</h2>
|
||||
<ul>
|
||||
<li><a href="../api/add_row.html">Dynamically add a new row</a></li>
|
||||
<li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
|
||||
<li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
|
||||
<li><a href="../api/highlight.html">Highlight rows and columns</a></li>
|
||||
<li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
|
||||
<li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
|
||||
<li><a href="../api/form.html">Submit form with elements in table</a></li>
|
||||
<li><a href="../api/counter_column.html">Index column (static number column)</a></li>
|
||||
<li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
|
||||
<li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
|
||||
<li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
|
||||
<li><a href="../api/regex.html">Regular expression filtering</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="demo_links">
|
||||
<h2>Data sources</h2>
|
||||
<ul>
|
||||
<li><a href="../data_sources/dom.html">DOM</a></li>
|
||||
<li><a href="../data_sources/js_array.html">Javascript array</a></li>
|
||||
<li><a href="../data_sources/ajax.html">Ajax source</a></li>
|
||||
<li><a href="../data_sources/server_side.html">Server side processing</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Server-side processing</h2>
|
||||
<ul>
|
||||
<li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
|
||||
<li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
|
||||
<li><a href="../server_side/post.html">Use HTTP POST</a></li>
|
||||
<li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
|
||||
<li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
|
||||
<li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
|
||||
<li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
|
||||
<li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
|
||||
<li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Ajax data source</h2>
|
||||
<ul>
|
||||
<li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
|
||||
<li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
|
||||
<li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
|
||||
<li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
|
||||
<li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
|
||||
<li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
|
||||
<li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Plug-ins</h2>
|
||||
<ul>
|
||||
<li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
|
||||
<li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
|
||||
<li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
|
||||
<li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
|
||||
<li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer" class="clear" style="text-align:center;">
|
||||
<p>
|
||||
Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<span style="font-size:10px;">
|
||||
DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
|
||||
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>.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,232 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
|
||||
|
||||
<title>DataTables example</title>
|
||||
<style type="text/css" title="currentStyle">
|
||||
@import "../../media/css/demo_page.css";
|
||||
@import "../../media/css/demo_table.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="../examples_support/jquery.jeditable.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(document).ready(function() {
|
||||
var oTable = $('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/server_processing.php",
|
||||
"fnDrawCallback": function () {
|
||||
$('#example tbody td').editable( '../examples_support/editable_ajax.php', {
|
||||
"callback": function( sValue, y ) {
|
||||
/* Redraw the table from the new data on the server */
|
||||
oTable.fnDraw();
|
||||
},
|
||||
"height": "14px"
|
||||
} );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body id="dt_example">
|
||||
<div id="container">
|
||||
<div class="full_width big">
|
||||
DataTables server-side processing example
|
||||
</div>
|
||||
|
||||
<h1>Preamble</h1>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<h1>Live example</h1>
|
||||
<div id="dynamic">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">Rendering engine</th>
|
||||
<th width="25%">Browser</th>
|
||||
<th width="25%">Platform(s)</th>
|
||||
<th width="15%">Engine version</th>
|
||||
<th width="15%">CSS grade</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="5" class="dataTables_empty">Loading data from server</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Rendering engine</th>
|
||||
<th>Browser</th>
|
||||
<th>Platform(s)</th>
|
||||
<th>Engine version</th>
|
||||
<th>CSS grade</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
|
||||
|
||||
<h1>Initialisation code</h1>
|
||||
<pre class="brush: js;">$(document).ready(function() {
|
||||
var oTable = $('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/server_processing.php",
|
||||
"fnDrawCallback": function () {
|
||||
$('#example tbody td').editable( '../examples_support/editable_ajax.php', {
|
||||
"callback": function( sValue, y ) {
|
||||
/* Redraw the table from the new data on the server */
|
||||
oTable.fnDraw();
|
||||
},
|
||||
"height": "14px"
|
||||
} );
|
||||
}
|
||||
} );
|
||||
} );</pre>
|
||||
<style type="text/css">
|
||||
@import "../examples_support/syntax/css/shCore.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
|
||||
|
||||
<h1>Server response</h1>
|
||||
<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>
|
||||
<pre id="latest_xhr" class="brush: js;"></pre>
|
||||
|
||||
|
||||
<h1>Other examples</h1>
|
||||
<div class="demo_links">
|
||||
<h2>Basic initialisation</h2>
|
||||
<ul>
|
||||
<li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
|
||||
<li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
|
||||
<li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
|
||||
<li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
|
||||
<li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
|
||||
<li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
|
||||
<li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
|
||||
<li><a href="../basic_init/dom.html">DOM positioning</a></li>
|
||||
<li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
|
||||
<li><a href="../basic_init/state_save.html">State saving</a></li>
|
||||
<li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
|
||||
<li>Scrolling: <br>
|
||||
<a href="../basic_init/scroll_x.html">Horizontal</a> /
|
||||
<a href="../basic_init/scroll_y.html">Vertical</a> /
|
||||
<a href="../basic_init/scroll_xy.html">Both</a> /
|
||||
<a href="../basic_init/scroll_y_theme.html">Themed</a> /
|
||||
<a href="../basic_init/scroll_y_infinite.html">Infinite</a>
|
||||
</li>
|
||||
<li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
|
||||
<li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Advanced initialisation</h2>
|
||||
<ul>
|
||||
<li>Events: <br>
|
||||
<a href="../advanced_init/events_live.html">Live events</a> /
|
||||
<a href="../advanced_init/events_pre_init.html">Pre-init</a> /
|
||||
<a href="../advanced_init/events_post_init.html">Post-init</a>
|
||||
</li>
|
||||
<li><a href="../advanced_init/column_render.html">Column rendering</a></li>
|
||||
<li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
|
||||
<li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
|
||||
<li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
|
||||
<li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
|
||||
<li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
|
||||
<li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
|
||||
<li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
|
||||
<li><a href="../advanced_init/row_callback.html">Row callback</a></li>
|
||||
<li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
|
||||
<li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
|
||||
<li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
|
||||
<li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
|
||||
<li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
|
||||
<li><a href="../advanced_init/dt_events.html">Custom events</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>API</h2>
|
||||
<ul>
|
||||
<li><a href="../api/add_row.html">Dynamically add a new row</a></li>
|
||||
<li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
|
||||
<li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
|
||||
<li><a href="../api/highlight.html">Highlight rows and columns</a></li>
|
||||
<li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
|
||||
<li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
|
||||
<li><a href="../api/form.html">Submit form with elements in table</a></li>
|
||||
<li><a href="../api/counter_column.html">Index column (static number column)</a></li>
|
||||
<li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
|
||||
<li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
|
||||
<li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
|
||||
<li><a href="../api/regex.html">Regular expression filtering</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="demo_links">
|
||||
<h2>Data sources</h2>
|
||||
<ul>
|
||||
<li><a href="../data_sources/dom.html">DOM</a></li>
|
||||
<li><a href="../data_sources/js_array.html">Javascript array</a></li>
|
||||
<li><a href="../data_sources/ajax.html">Ajax source</a></li>
|
||||
<li><a href="../data_sources/server_side.html">Server side processing</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Server-side processing</h2>
|
||||
<ul>
|
||||
<li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
|
||||
<li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
|
||||
<li><a href="../server_side/post.html">Use HTTP POST</a></li>
|
||||
<li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
|
||||
<li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
|
||||
<li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
|
||||
<li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
|
||||
<li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
|
||||
<li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Ajax data source</h2>
|
||||
<ul>
|
||||
<li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
|
||||
<li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
|
||||
<li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
|
||||
<li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
|
||||
<li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
|
||||
<li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
|
||||
<li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Plug-ins</h2>
|
||||
<ul>
|
||||
<li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
|
||||
<li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
|
||||
<li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
|
||||
<li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
|
||||
<li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer" class="clear" style="text-align:center;">
|
||||
<p>
|
||||
Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<span style="font-size:10px;">
|
||||
DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
|
||||
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>.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,212 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
|
||||
|
||||
<title>DataTables example</title>
|
||||
<style type="text/css" title="currentStyle">
|
||||
@import "../../media/css/demo_page.css";
|
||||
@import "../../media/css/demo_table.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/id.php"
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body id="dt_example">
|
||||
<div id="container">
|
||||
<div class="full_width big">
|
||||
DataTables server-side processing example - automatic row ID addition
|
||||
</div>
|
||||
|
||||
<h1>Preamble</h1>
|
||||
<p>Often when using server-side processing you will find that it can be useful to have a specific ID on each row (the row ID from the database for example). By assigning the ID you want to apply to each row using the property <b>DT_RowId</b> of the data source object for each row, DataTables will automatically add it for you. Likewise there is a <b>DT_RowClass</b> option which will add your given class. This example shows both and is a trivial modification of the server-side script to add these two options, with no changes on the client-side.</p>
|
||||
|
||||
<h1>Live example</h1>
|
||||
<div id="dynamic">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">Rendering engine</th>
|
||||
<th width="25%">Browser</th>
|
||||
<th width="25%">Platform(s)</th>
|
||||
<th width="15%">Engine version</th>
|
||||
<th width="15%">CSS grade</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="5" class="dataTables_empty">Loading data from server</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Rendering engine</th>
|
||||
<th>Browser</th>
|
||||
<th>Platform(s)</th>
|
||||
<th>Engine version</th>
|
||||
<th>CSS grade</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
|
||||
|
||||
<h1>Initialisation code</h1>
|
||||
<pre class="brush: js;">$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/id.php"
|
||||
} );
|
||||
} );</pre>
|
||||
<style type="text/css">
|
||||
@import "../examples_support/syntax/css/shCore.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
|
||||
|
||||
<h1>Server response</h1>
|
||||
<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>
|
||||
<pre id="latest_xhr" class="brush: js;"></pre>
|
||||
|
||||
|
||||
<h1>Other examples</h1>
|
||||
<div class="demo_links">
|
||||
<h2>Basic initialisation</h2>
|
||||
<ul>
|
||||
<li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
|
||||
<li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
|
||||
<li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
|
||||
<li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
|
||||
<li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
|
||||
<li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
|
||||
<li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
|
||||
<li><a href="../basic_init/dom.html">DOM positioning</a></li>
|
||||
<li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
|
||||
<li><a href="../basic_init/state_save.html">State saving</a></li>
|
||||
<li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
|
||||
<li>Scrolling: <br>
|
||||
<a href="../basic_init/scroll_x.html">Horizontal</a> /
|
||||
<a href="../basic_init/scroll_y.html">Vertical</a> /
|
||||
<a href="../basic_init/scroll_xy.html">Both</a> /
|
||||
<a href="../basic_init/scroll_y_theme.html">Themed</a> /
|
||||
<a href="../basic_init/scroll_y_infinite.html">Infinite</a>
|
||||
</li>
|
||||
<li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
|
||||
<li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Advanced initialisation</h2>
|
||||
<ul>
|
||||
<li>Events: <br>
|
||||
<a href="../advanced_init/events_live.html">Live events</a> /
|
||||
<a href="../advanced_init/events_pre_init.html">Pre-init</a> /
|
||||
<a href="../advanced_init/events_post_init.html">Post-init</a>
|
||||
</li>
|
||||
<li><a href="../advanced_init/column_render.html">Column rendering</a></li>
|
||||
<li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
|
||||
<li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
|
||||
<li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
|
||||
<li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
|
||||
<li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
|
||||
<li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
|
||||
<li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
|
||||
<li><a href="../advanced_init/row_callback.html">Row callback</a></li>
|
||||
<li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
|
||||
<li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
|
||||
<li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
|
||||
<li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
|
||||
<li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
|
||||
<li><a href="../advanced_init/dt_events.html">Custom events</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>API</h2>
|
||||
<ul>
|
||||
<li><a href="../api/add_row.html">Dynamically add a new row</a></li>
|
||||
<li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
|
||||
<li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
|
||||
<li><a href="../api/highlight.html">Highlight rows and columns</a></li>
|
||||
<li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
|
||||
<li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
|
||||
<li><a href="../api/form.html">Submit form with elements in table</a></li>
|
||||
<li><a href="../api/counter_column.html">Index column (static number column)</a></li>
|
||||
<li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
|
||||
<li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
|
||||
<li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
|
||||
<li><a href="../api/regex.html">Regular expression filtering</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="demo_links">
|
||||
<h2>Data sources</h2>
|
||||
<ul>
|
||||
<li><a href="../data_sources/dom.html">DOM</a></li>
|
||||
<li><a href="../data_sources/js_array.html">Javascript array</a></li>
|
||||
<li><a href="../data_sources/ajax.html">Ajax source</a></li>
|
||||
<li><a href="../data_sources/server_side.html">Server side processing</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Server-side processing</h2>
|
||||
<ul>
|
||||
<li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
|
||||
<li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
|
||||
<li><a href="../server_side/post.html">Use HTTP POST</a></li>
|
||||
<li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
|
||||
<li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
|
||||
<li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
|
||||
<li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
|
||||
<li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
|
||||
<li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Ajax data source</h2>
|
||||
<ul>
|
||||
<li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
|
||||
<li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
|
||||
<li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
|
||||
<li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
|
||||
<li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
|
||||
<li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
|
||||
<li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Plug-ins</h2>
|
||||
<ul>
|
||||
<li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
|
||||
<li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
|
||||
<li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
|
||||
<li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
|
||||
<li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer" class="clear" style="text-align:center;">
|
||||
<p>
|
||||
Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<span style="font-size:10px;">
|
||||
DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
|
||||
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>.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,230 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
|
||||
|
||||
<title>DataTables example</title>
|
||||
<style type="text/css" title="currentStyle">
|
||||
@import "../../media/css/demo_page.css";
|
||||
@import "../../media/css/demo_table.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/jsonp.php",
|
||||
"fnServerData": function( sUrl, aoData, fnCallback, oSettings ) {
|
||||
oSettings.jqXHR = $.ajax( {
|
||||
"url": sUrl,
|
||||
"data": aoData,
|
||||
"success": fnCallback,
|
||||
"dataType": "jsonp",
|
||||
"cache": false
|
||||
} );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body id="dt_example">
|
||||
<div id="container">
|
||||
<div class="full_width big">
|
||||
DataTables server-side processing example with JSONP
|
||||
</div>
|
||||
|
||||
<h1>Preamble</h1>
|
||||
<p><a href="http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/">JSONP</a> is a method of using JSON data from any server, regardless of XSS protection that modern browsers use. It is very useful for being able to retrieve JSON data from any domain name you choose and is easy to integrate with DataTables, thanks to jQuery's Ajax handler, as shown in this example.</p>
|
||||
|
||||
<h1>Live example</h1>
|
||||
<div id="dynamic">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">Rendering engine</th>
|
||||
<th width="25%">Browser</th>
|
||||
<th width="25%">Platform(s)</th>
|
||||
<th width="15%">Engine version</th>
|
||||
<th width="15%">CSS grade</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="5" class="dataTables_empty">Loading data from server</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Rendering engine</th>
|
||||
<th>Browser</th>
|
||||
<th>Platform(s)</th>
|
||||
<th>Engine version</th>
|
||||
<th>CSS grade</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
|
||||
|
||||
<h1>Initialisation code</h1>
|
||||
<pre class="brush: js;">$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/jsonp.php",
|
||||
"fnServerData": function( sUrl, aoData, fnCallback, oSettings ) {
|
||||
oSettings.jqXHR = $.ajax( {
|
||||
"url": sUrl,
|
||||
"data": aoData,
|
||||
"success": fnCallback,
|
||||
"dataType": "jsonp",
|
||||
"cache": false
|
||||
} );
|
||||
}
|
||||
} );
|
||||
} );</pre>
|
||||
<style type="text/css">
|
||||
@import "../examples_support/syntax/css/shCore.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
|
||||
|
||||
<h1>Server response</h1>
|
||||
<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>
|
||||
<pre id="latest_xhr" class="brush: js;"></pre>
|
||||
|
||||
|
||||
<h1>Other examples</h1>
|
||||
<div class="demo_links">
|
||||
<h2>Basic initialisation</h2>
|
||||
<ul>
|
||||
<li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
|
||||
<li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
|
||||
<li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
|
||||
<li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
|
||||
<li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
|
||||
<li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
|
||||
<li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
|
||||
<li><a href="../basic_init/dom.html">DOM positioning</a></li>
|
||||
<li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
|
||||
<li><a href="../basic_init/state_save.html">State saving</a></li>
|
||||
<li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
|
||||
<li>Scrolling: <br>
|
||||
<a href="../basic_init/scroll_x.html">Horizontal</a> /
|
||||
<a href="../basic_init/scroll_y.html">Vertical</a> /
|
||||
<a href="../basic_init/scroll_xy.html">Both</a> /
|
||||
<a href="../basic_init/scroll_y_theme.html">Themed</a> /
|
||||
<a href="../basic_init/scroll_y_infinite.html">Infinite</a>
|
||||
</li>
|
||||
<li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
|
||||
<li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Advanced initialisation</h2>
|
||||
<ul>
|
||||
<li>Events: <br>
|
||||
<a href="../advanced_init/events_live.html">Live events</a> /
|
||||
<a href="../advanced_init/events_pre_init.html">Pre-init</a> /
|
||||
<a href="../advanced_init/events_post_init.html">Post-init</a>
|
||||
</li>
|
||||
<li><a href="../advanced_init/column_render.html">Column rendering</a></li>
|
||||
<li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
|
||||
<li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
|
||||
<li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
|
||||
<li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
|
||||
<li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
|
||||
<li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
|
||||
<li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
|
||||
<li><a href="../advanced_init/row_callback.html">Row callback</a></li>
|
||||
<li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
|
||||
<li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
|
||||
<li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
|
||||
<li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
|
||||
<li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
|
||||
<li><a href="../advanced_init/dt_events.html">Custom events</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>API</h2>
|
||||
<ul>
|
||||
<li><a href="../api/add_row.html">Dynamically add a new row</a></li>
|
||||
<li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
|
||||
<li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
|
||||
<li><a href="../api/highlight.html">Highlight rows and columns</a></li>
|
||||
<li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
|
||||
<li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
|
||||
<li><a href="../api/form.html">Submit form with elements in table</a></li>
|
||||
<li><a href="../api/counter_column.html">Index column (static number column)</a></li>
|
||||
<li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
|
||||
<li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
|
||||
<li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
|
||||
<li><a href="../api/regex.html">Regular expression filtering</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="demo_links">
|
||||
<h2>Data sources</h2>
|
||||
<ul>
|
||||
<li><a href="../data_sources/dom.html">DOM</a></li>
|
||||
<li><a href="../data_sources/js_array.html">Javascript array</a></li>
|
||||
<li><a href="../data_sources/ajax.html">Ajax source</a></li>
|
||||
<li><a href="../data_sources/server_side.html">Server side processing</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Server-side processing</h2>
|
||||
<ul>
|
||||
<li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
|
||||
<li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
|
||||
<li><a href="../server_side/post.html">Use HTTP POST</a></li>
|
||||
<li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
|
||||
<li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
|
||||
<li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
|
||||
<li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
|
||||
<li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
|
||||
<li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Ajax data source</h2>
|
||||
<ul>
|
||||
<li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
|
||||
<li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
|
||||
<li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
|
||||
<li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
|
||||
<li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
|
||||
<li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
|
||||
<li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Plug-ins</h2>
|
||||
<ul>
|
||||
<li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
|
||||
<li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
|
||||
<li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
|
||||
<li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
|
||||
<li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer" class="clear" style="text-align:center;">
|
||||
<p>
|
||||
Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<span style="font-size:10px;">
|
||||
DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
|
||||
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>.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,227 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
|
||||
|
||||
<title>DataTables example</title>
|
||||
<style type="text/css" title="currentStyle">
|
||||
@import "../../media/css/demo_page.css";
|
||||
@import "../../media/css/demo_table.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/objects.php",
|
||||
"aoColumns": [
|
||||
{ "mData": "engine" },
|
||||
{ "mData": "browser" },
|
||||
{ "mData": "platform" },
|
||||
{ "mData": "version" },
|
||||
{ "mData": "grade" }
|
||||
]
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body id="dt_example">
|
||||
<div id="container">
|
||||
<div class="full_width big">
|
||||
DataTables server-side processing example - object based data source
|
||||
</div>
|
||||
|
||||
<h1>Preamble</h1>
|
||||
<p>The "native" data format that DataTables expects for server-side processing is a 2D array of data (rows by columns). However, this is often not flexible enough for either the server-side environment, or you might want to convey more information in the data source than is necessary to show in the table (row IDs from the database for example). For this DataTables supports the reading of data for objects as well as arrays.</p>
|
||||
<p>In this example the server responds with an array of objects, and DataTables will look up each property that is specified by the <b>mData</b> property given for each column</p>
|
||||
|
||||
<h1>Live example</h1>
|
||||
<div id="dynamic">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">Rendering engine</th>
|
||||
<th width="25%">Browser</th>
|
||||
<th width="25%">Platform(s)</th>
|
||||
<th width="15%">Engine version</th>
|
||||
<th width="15%">CSS grade</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="5" class="dataTables_empty">Loading data from server</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Rendering engine</th>
|
||||
<th>Browser</th>
|
||||
<th>Platform(s)</th>
|
||||
<th>Engine version</th>
|
||||
<th>CSS grade</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
|
||||
|
||||
<h1>Initialisation code</h1>
|
||||
<pre class="brush: js;">$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/objects.php",
|
||||
"aoColumns": [
|
||||
{ "mData": "engine" },
|
||||
{ "mData": "browser" },
|
||||
{ "mData": "platform" },
|
||||
{ "mData": "version" },
|
||||
{ "mData": "grade" }
|
||||
]
|
||||
} );
|
||||
} );</pre>
|
||||
<style type="text/css">
|
||||
@import "../examples_support/syntax/css/shCore.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
|
||||
|
||||
<h1>Server response</h1>
|
||||
<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>
|
||||
<pre id="latest_xhr" class="brush: js;"></pre>
|
||||
|
||||
|
||||
<h1>Other examples</h1>
|
||||
<div class="demo_links">
|
||||
<h2>Basic initialisation</h2>
|
||||
<ul>
|
||||
<li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
|
||||
<li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
|
||||
<li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
|
||||
<li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
|
||||
<li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
|
||||
<li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
|
||||
<li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
|
||||
<li><a href="../basic_init/dom.html">DOM positioning</a></li>
|
||||
<li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
|
||||
<li><a href="../basic_init/state_save.html">State saving</a></li>
|
||||
<li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
|
||||
<li>Scrolling: <br>
|
||||
<a href="../basic_init/scroll_x.html">Horizontal</a> /
|
||||
<a href="../basic_init/scroll_y.html">Vertical</a> /
|
||||
<a href="../basic_init/scroll_xy.html">Both</a> /
|
||||
<a href="../basic_init/scroll_y_theme.html">Themed</a> /
|
||||
<a href="../basic_init/scroll_y_infinite.html">Infinite</a>
|
||||
</li>
|
||||
<li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
|
||||
<li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Advanced initialisation</h2>
|
||||
<ul>
|
||||
<li>Events: <br>
|
||||
<a href="../advanced_init/events_live.html">Live events</a> /
|
||||
<a href="../advanced_init/events_pre_init.html">Pre-init</a> /
|
||||
<a href="../advanced_init/events_post_init.html">Post-init</a>
|
||||
</li>
|
||||
<li><a href="../advanced_init/column_render.html">Column rendering</a></li>
|
||||
<li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
|
||||
<li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
|
||||
<li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
|
||||
<li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
|
||||
<li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
|
||||
<li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
|
||||
<li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
|
||||
<li><a href="../advanced_init/row_callback.html">Row callback</a></li>
|
||||
<li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
|
||||
<li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
|
||||
<li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
|
||||
<li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
|
||||
<li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
|
||||
<li><a href="../advanced_init/dt_events.html">Custom events</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>API</h2>
|
||||
<ul>
|
||||
<li><a href="../api/add_row.html">Dynamically add a new row</a></li>
|
||||
<li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
|
||||
<li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
|
||||
<li><a href="../api/highlight.html">Highlight rows and columns</a></li>
|
||||
<li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
|
||||
<li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
|
||||
<li><a href="../api/form.html">Submit form with elements in table</a></li>
|
||||
<li><a href="../api/counter_column.html">Index column (static number column)</a></li>
|
||||
<li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
|
||||
<li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
|
||||
<li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
|
||||
<li><a href="../api/regex.html">Regular expression filtering</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="demo_links">
|
||||
<h2>Data sources</h2>
|
||||
<ul>
|
||||
<li><a href="../data_sources/dom.html">DOM</a></li>
|
||||
<li><a href="../data_sources/js_array.html">Javascript array</a></li>
|
||||
<li><a href="../data_sources/ajax.html">Ajax source</a></li>
|
||||
<li><a href="../data_sources/server_side.html">Server side processing</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Server-side processing</h2>
|
||||
<ul>
|
||||
<li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
|
||||
<li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
|
||||
<li><a href="../server_side/post.html">Use HTTP POST</a></li>
|
||||
<li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
|
||||
<li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
|
||||
<li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
|
||||
<li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
|
||||
<li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
|
||||
<li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Ajax data source</h2>
|
||||
<ul>
|
||||
<li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
|
||||
<li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
|
||||
<li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
|
||||
<li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
|
||||
<li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
|
||||
<li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
|
||||
<li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Plug-ins</h2>
|
||||
<ul>
|
||||
<li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
|
||||
<li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
|
||||
<li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
|
||||
<li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
|
||||
<li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer" class="clear" style="text-align:center;">
|
||||
<p>
|
||||
Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<span style="font-size:10px;">
|
||||
DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
|
||||
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>.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,421 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
|
||||
|
||||
<title>DataTables example</title>
|
||||
<style type="text/css" title="currentStyle">
|
||||
@import "../../media/css/demo_page.css";
|
||||
@import "../../media/css/demo_table.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var oCache = {
|
||||
iCacheLower: -1
|
||||
};
|
||||
|
||||
function fnSetKey( aoData, sKey, mValue )
|
||||
{
|
||||
for ( var i=0, iLen=aoData.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( aoData[i].name == sKey )
|
||||
{
|
||||
aoData[i].value = mValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fnGetKey( aoData, sKey )
|
||||
{
|
||||
for ( var i=0, iLen=aoData.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( aoData[i].name == sKey )
|
||||
{
|
||||
return aoData[i].value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function fnDataTablesPipeline ( sSource, aoData, fnCallback, oSettings ) {
|
||||
var iPipe = 5; /* Ajust the pipe size */
|
||||
|
||||
var bNeedServer = false;
|
||||
var sEcho = fnGetKey(aoData, "sEcho");
|
||||
var iRequestStart = fnGetKey(aoData, "iDisplayStart");
|
||||
var iRequestLength = fnGetKey(aoData, "iDisplayLength");
|
||||
var iRequestEnd = iRequestStart + iRequestLength;
|
||||
oCache.iDisplayStart = iRequestStart;
|
||||
|
||||
/* outside pipeline? */
|
||||
if ( oCache.iCacheLower < 0 || iRequestStart < oCache.iCacheLower || iRequestEnd > oCache.iCacheUpper )
|
||||
{
|
||||
bNeedServer = true;
|
||||
}
|
||||
|
||||
/* sorting etc changed? */
|
||||
if ( oCache.lastRequest && !bNeedServer )
|
||||
{
|
||||
for( var i=0, iLen=aoData.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( aoData[i].name != "iDisplayStart" && aoData[i].name != "iDisplayLength" && aoData[i].name != "sEcho" )
|
||||
{
|
||||
if ( aoData[i].value != oCache.lastRequest[i].value )
|
||||
{
|
||||
bNeedServer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Store the request for checking next time around */
|
||||
oCache.lastRequest = aoData.slice();
|
||||
|
||||
if ( bNeedServer )
|
||||
{
|
||||
if ( iRequestStart < oCache.iCacheLower )
|
||||
{
|
||||
iRequestStart = iRequestStart - (iRequestLength*(iPipe-1));
|
||||
if ( iRequestStart < 0 )
|
||||
{
|
||||
iRequestStart = 0;
|
||||
}
|
||||
}
|
||||
|
||||
oCache.iCacheLower = iRequestStart;
|
||||
oCache.iCacheUpper = iRequestStart + (iRequestLength * iPipe);
|
||||
oCache.iDisplayLength = fnGetKey( aoData, "iDisplayLength" );
|
||||
fnSetKey( aoData, "iDisplayStart", iRequestStart );
|
||||
fnSetKey( aoData, "iDisplayLength", iRequestLength*iPipe );
|
||||
|
||||
oSettings.jqXHR = $.getJSON( sSource, aoData, function (json) {
|
||||
/* Callback processing */
|
||||
oCache.lastJson = jQuery.extend(true, {}, json);
|
||||
|
||||
if ( oCache.iCacheLower != oCache.iDisplayStart )
|
||||
{
|
||||
json.aaData.splice( 0, oCache.iDisplayStart-oCache.iCacheLower );
|
||||
}
|
||||
json.aaData.splice( oCache.iDisplayLength, json.aaData.length );
|
||||
|
||||
fnCallback(json)
|
||||
} );
|
||||
}
|
||||
else
|
||||
{
|
||||
json = jQuery.extend(true, {}, oCache.lastJson);
|
||||
json.sEcho = sEcho; /* Update the echo for each response */
|
||||
json.aaData.splice( 0, iRequestStart-oCache.iCacheLower );
|
||||
json.aaData.splice( iRequestLength, json.aaData.length );
|
||||
fnCallback(json);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/server_processing.php",
|
||||
"fnServerData": fnDataTablesPipeline
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body id="dt_example">
|
||||
<div id="container">
|
||||
<div class="full_width big">
|
||||
DataTables server-side processing with pipelining example
|
||||
</div>
|
||||
|
||||
<h1>Preamble</h1>
|
||||
<p>When using server-side processing with DataTables, it can be quite intensive on your server having an Ajax call every time the user performs some kind of interaction - you can effectively DDOS your server with your own application!</p>
|
||||
<p>This example shows how you might over-come this by modifying the request set to the server to retrieve more information than is actually required for a single page's display. This means that the user can page multiple times (5 times the display size is the default) before a request must be made of the server. Paging is typically the most common interaction performed with a DataTable, so this can be most beneficial to your server's resource usage. Of course the pipeline must be cleared for interactions other than paging (sorting, filtering etc), but that's the trade off that can be made (sending extra information is cheap - while another XHR is expensive).</p>
|
||||
|
||||
<h1>Live example</h1>
|
||||
<div id="dynamic">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">Rendering engine</th>
|
||||
<th width="25%">Browser</th>
|
||||
<th width="25%">Platform(s)</th>
|
||||
<th width="15%">Engine version</th>
|
||||
<th width="15%">CSS grade</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="5" class="dataTables_empty">Loading data from server</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Rendering engine</th>
|
||||
<th>Browser</th>
|
||||
<th>Platform(s)</th>
|
||||
<th>Engine version</th>
|
||||
<th>CSS grade</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
|
||||
|
||||
<h1>Initialisation code</h1>
|
||||
<pre class="brush: js;">var oCache = {
|
||||
iCacheLower: -1
|
||||
};
|
||||
|
||||
function fnSetKey( aoData, sKey, mValue )
|
||||
{
|
||||
for ( var i=0, iLen=aoData.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( aoData[i].name == sKey )
|
||||
{
|
||||
aoData[i].value = mValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fnGetKey( aoData, sKey )
|
||||
{
|
||||
for ( var i=0, iLen=aoData.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( aoData[i].name == sKey )
|
||||
{
|
||||
return aoData[i].value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function fnDataTablesPipeline ( sSource, aoData, fnCallback ) {
|
||||
var iPipe = 5; /* Ajust the pipe size */
|
||||
|
||||
var bNeedServer = false;
|
||||
var sEcho = fnGetKey(aoData, "sEcho");
|
||||
var iRequestStart = fnGetKey(aoData, "iDisplayStart");
|
||||
var iRequestLength = fnGetKey(aoData, "iDisplayLength");
|
||||
var iRequestEnd = iRequestStart + iRequestLength;
|
||||
oCache.iDisplayStart = iRequestStart;
|
||||
|
||||
/* outside pipeline? */
|
||||
if ( oCache.iCacheLower < 0 || iRequestStart < oCache.iCacheLower || iRequestEnd > oCache.iCacheUpper )
|
||||
{
|
||||
bNeedServer = true;
|
||||
}
|
||||
|
||||
/* sorting etc changed? */
|
||||
if ( oCache.lastRequest && !bNeedServer )
|
||||
{
|
||||
for( var i=0, iLen=aoData.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( aoData[i].name != "iDisplayStart" && aoData[i].name != "iDisplayLength" && aoData[i].name != "sEcho" )
|
||||
{
|
||||
if ( aoData[i].value != oCache.lastRequest[i].value )
|
||||
{
|
||||
bNeedServer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Store the request for checking next time around */
|
||||
oCache.lastRequest = aoData.slice();
|
||||
|
||||
if ( bNeedServer )
|
||||
{
|
||||
if ( iRequestStart < oCache.iCacheLower )
|
||||
{
|
||||
iRequestStart = iRequestStart - (iRequestLength*(iPipe-1));
|
||||
if ( iRequestStart < 0 )
|
||||
{
|
||||
iRequestStart = 0;
|
||||
}
|
||||
}
|
||||
|
||||
oCache.iCacheLower = iRequestStart;
|
||||
oCache.iCacheUpper = iRequestStart + (iRequestLength * iPipe);
|
||||
oCache.iDisplayLength = fnGetKey( aoData, "iDisplayLength" );
|
||||
fnSetKey( aoData, "iDisplayStart", iRequestStart );
|
||||
fnSetKey( aoData, "iDisplayLength", iRequestLength*iPipe );
|
||||
|
||||
$.getJSON( sSource, aoData, function (json) {
|
||||
/* Callback processing */
|
||||
oCache.lastJson = jQuery.extend(true, {}, json);
|
||||
|
||||
if ( oCache.iCacheLower != oCache.iDisplayStart )
|
||||
{
|
||||
json.aaData.splice( 0, oCache.iDisplayStart-oCache.iCacheLower );
|
||||
}
|
||||
json.aaData.splice( oCache.iDisplayLength, json.aaData.length );
|
||||
|
||||
fnCallback(json)
|
||||
} );
|
||||
}
|
||||
else
|
||||
{
|
||||
json = jQuery.extend(true, {}, oCache.lastJson);
|
||||
json.sEcho = sEcho; /* Update the echo for each response */
|
||||
json.aaData.splice( 0, iRequestStart-oCache.iCacheLower );
|
||||
json.aaData.splice( iRequestLength, json.aaData.length );
|
||||
fnCallback(json);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/server_processing.php",
|
||||
"fnServerData": fnDataTablesPipeline
|
||||
} );
|
||||
} );</pre>
|
||||
<style type="text/css">
|
||||
@import "../examples_support/syntax/css/shCore.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
|
||||
|
||||
<h1>Server response</h1>
|
||||
<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>
|
||||
<pre id="latest_xhr" class="brush: js;"></pre>
|
||||
|
||||
|
||||
<h1>Other examples</h1>
|
||||
<div class="demo_links">
|
||||
<h2>Basic initialisation</h2>
|
||||
<ul>
|
||||
<li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
|
||||
<li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
|
||||
<li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
|
||||
<li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
|
||||
<li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
|
||||
<li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
|
||||
<li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
|
||||
<li><a href="../basic_init/dom.html">DOM positioning</a></li>
|
||||
<li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
|
||||
<li><a href="../basic_init/state_save.html">State saving</a></li>
|
||||
<li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
|
||||
<li>Scrolling: <br>
|
||||
<a href="../basic_init/scroll_x.html">Horizontal</a> /
|
||||
<a href="../basic_init/scroll_y.html">Vertical</a> /
|
||||
<a href="../basic_init/scroll_xy.html">Both</a> /
|
||||
<a href="../basic_init/scroll_y_theme.html">Themed</a> /
|
||||
<a href="../basic_init/scroll_y_infinite.html">Infinite</a>
|
||||
</li>
|
||||
<li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
|
||||
<li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Advanced initialisation</h2>
|
||||
<ul>
|
||||
<li>Events: <br>
|
||||
<a href="../advanced_init/events_live.html">Live events</a> /
|
||||
<a href="../advanced_init/events_pre_init.html">Pre-init</a> /
|
||||
<a href="../advanced_init/events_post_init.html">Post-init</a>
|
||||
</li>
|
||||
<li><a href="../advanced_init/column_render.html">Column rendering</a></li>
|
||||
<li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
|
||||
<li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
|
||||
<li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
|
||||
<li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
|
||||
<li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
|
||||
<li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
|
||||
<li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
|
||||
<li><a href="../advanced_init/row_callback.html">Row callback</a></li>
|
||||
<li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
|
||||
<li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
|
||||
<li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
|
||||
<li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
|
||||
<li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
|
||||
<li><a href="../advanced_init/dt_events.html">Custom events</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>API</h2>
|
||||
<ul>
|
||||
<li><a href="../api/add_row.html">Dynamically add a new row</a></li>
|
||||
<li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
|
||||
<li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
|
||||
<li><a href="../api/highlight.html">Highlight rows and columns</a></li>
|
||||
<li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
|
||||
<li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
|
||||
<li><a href="../api/form.html">Submit form with elements in table</a></li>
|
||||
<li><a href="../api/counter_column.html">Index column (static number column)</a></li>
|
||||
<li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
|
||||
<li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
|
||||
<li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
|
||||
<li><a href="../api/regex.html">Regular expression filtering</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="demo_links">
|
||||
<h2>Data sources</h2>
|
||||
<ul>
|
||||
<li><a href="../data_sources/dom.html">DOM</a></li>
|
||||
<li><a href="../data_sources/js_array.html">Javascript array</a></li>
|
||||
<li><a href="../data_sources/ajax.html">Ajax source</a></li>
|
||||
<li><a href="../data_sources/server_side.html">Server side processing</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Server-side processing</h2>
|
||||
<ul>
|
||||
<li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
|
||||
<li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
|
||||
<li><a href="../server_side/post.html">Use HTTP POST</a></li>
|
||||
<li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
|
||||
<li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
|
||||
<li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
|
||||
<li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
|
||||
<li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
|
||||
<li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Ajax data source</h2>
|
||||
<ul>
|
||||
<li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
|
||||
<li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
|
||||
<li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
|
||||
<li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
|
||||
<li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
|
||||
<li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
|
||||
<li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Plug-ins</h2>
|
||||
<ul>
|
||||
<li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
|
||||
<li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
|
||||
<li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
|
||||
<li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
|
||||
<li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer" class="clear" style="text-align:center;">
|
||||
<p>
|
||||
Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<span style="font-size:10px;">
|
||||
DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
|
||||
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>.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,214 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
|
||||
|
||||
<title>DataTables example</title>
|
||||
<style type="text/css" title="currentStyle">
|
||||
@import "../../media/css/demo_page.css";
|
||||
@import "../../media/css/demo_table.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/post.php",
|
||||
"sServerMethod": "POST"
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body id="dt_example">
|
||||
<div id="container">
|
||||
<div class="full_width big">
|
||||
DataTables server-side processing with POST example
|
||||
</div>
|
||||
|
||||
<h1>Preamble</h1>
|
||||
<p>The default HTTP method that DataTables uses to get data from the server-side if GET, however, there are times when you may wish to use POST. This is very easy using the sServerMethod initialisation parameter, which is simply set to the HTTP method that you want to use - the default is 'GET' and this example shows 'POST' being used.</p>
|
||||
|
||||
<h1>Live example</h1>
|
||||
<div id="dynamic">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">Rendering engine</th>
|
||||
<th width="25%">Browser</th>
|
||||
<th width="25%">Platform(s)</th>
|
||||
<th width="15%">Engine version</th>
|
||||
<th width="15%">CSS grade</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="5" class="dataTables_empty">Loading data from server</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Rendering engine</th>
|
||||
<th>Browser</th>
|
||||
<th>Platform(s)</th>
|
||||
<th>Engine version</th>
|
||||
<th>CSS grade</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
|
||||
|
||||
<h1>Initialisation code</h1>
|
||||
<pre class="brush: js;">$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/post.php",
|
||||
"sServerMethod": "POST"
|
||||
} );
|
||||
} );</pre>
|
||||
<style type="text/css">
|
||||
@import "../examples_support/syntax/css/shCore.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
|
||||
|
||||
<h1>Server response</h1>
|
||||
<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>
|
||||
<pre id="latest_xhr" class="brush: js;"></pre>
|
||||
|
||||
|
||||
<h1>Other examples</h1>
|
||||
<div class="demo_links">
|
||||
<h2>Basic initialisation</h2>
|
||||
<ul>
|
||||
<li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
|
||||
<li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
|
||||
<li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
|
||||
<li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
|
||||
<li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
|
||||
<li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
|
||||
<li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
|
||||
<li><a href="../basic_init/dom.html">DOM positioning</a></li>
|
||||
<li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
|
||||
<li><a href="../basic_init/state_save.html">State saving</a></li>
|
||||
<li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
|
||||
<li>Scrolling: <br>
|
||||
<a href="../basic_init/scroll_x.html">Horizontal</a> /
|
||||
<a href="../basic_init/scroll_y.html">Vertical</a> /
|
||||
<a href="../basic_init/scroll_xy.html">Both</a> /
|
||||
<a href="../basic_init/scroll_y_theme.html">Themed</a> /
|
||||
<a href="../basic_init/scroll_y_infinite.html">Infinite</a>
|
||||
</li>
|
||||
<li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
|
||||
<li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Advanced initialisation</h2>
|
||||
<ul>
|
||||
<li>Events: <br>
|
||||
<a href="../advanced_init/events_live.html">Live events</a> /
|
||||
<a href="../advanced_init/events_pre_init.html">Pre-init</a> /
|
||||
<a href="../advanced_init/events_post_init.html">Post-init</a>
|
||||
</li>
|
||||
<li><a href="../advanced_init/column_render.html">Column rendering</a></li>
|
||||
<li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
|
||||
<li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
|
||||
<li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
|
||||
<li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
|
||||
<li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
|
||||
<li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
|
||||
<li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
|
||||
<li><a href="../advanced_init/row_callback.html">Row callback</a></li>
|
||||
<li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
|
||||
<li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
|
||||
<li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
|
||||
<li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
|
||||
<li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
|
||||
<li><a href="../advanced_init/dt_events.html">Custom events</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>API</h2>
|
||||
<ul>
|
||||
<li><a href="../api/add_row.html">Dynamically add a new row</a></li>
|
||||
<li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
|
||||
<li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
|
||||
<li><a href="../api/highlight.html">Highlight rows and columns</a></li>
|
||||
<li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
|
||||
<li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
|
||||
<li><a href="../api/form.html">Submit form with elements in table</a></li>
|
||||
<li><a href="../api/counter_column.html">Index column (static number column)</a></li>
|
||||
<li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
|
||||
<li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
|
||||
<li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
|
||||
<li><a href="../api/regex.html">Regular expression filtering</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="demo_links">
|
||||
<h2>Data sources</h2>
|
||||
<ul>
|
||||
<li><a href="../data_sources/dom.html">DOM</a></li>
|
||||
<li><a href="../data_sources/js_array.html">Javascript array</a></li>
|
||||
<li><a href="../data_sources/ajax.html">Ajax source</a></li>
|
||||
<li><a href="../data_sources/server_side.html">Server side processing</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Server-side processing</h2>
|
||||
<ul>
|
||||
<li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
|
||||
<li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
|
||||
<li><a href="../server_side/post.html">Use HTTP POST</a></li>
|
||||
<li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
|
||||
<li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
|
||||
<li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
|
||||
<li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
|
||||
<li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
|
||||
<li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Ajax data source</h2>
|
||||
<ul>
|
||||
<li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
|
||||
<li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
|
||||
<li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
|
||||
<li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
|
||||
<li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
|
||||
<li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
|
||||
<li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Plug-ins</h2>
|
||||
<ul>
|
||||
<li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
|
||||
<li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
|
||||
<li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
|
||||
<li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
|
||||
<li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer" class="clear" style="text-align:center;">
|
||||
<p>
|
||||
Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<span style="font-size:10px;">
|
||||
DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
|
||||
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>.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,294 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
|
||||
|
||||
<title>DataTables example</title>
|
||||
<style type="text/css" title="currentStyle">
|
||||
@import "../../media/css/demo_page.css";
|
||||
@import "../../media/css/demo_table.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var oTable;
|
||||
|
||||
/* Formating function for row details */
|
||||
function fnFormatDetails ( nTr )
|
||||
{
|
||||
var aData = oTable.fnGetData( nTr );
|
||||
var sOut = '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">';
|
||||
sOut += '<tr><td>Rendering engine:</td><td>'+aData[2]+' '+aData[5]+'</td></tr>';
|
||||
sOut += '<tr><td>Link to source:</td><td>Could provide a link here</td></tr>';
|
||||
sOut += '<tr><td>Extra info:</td><td>And any further details here (images etc)</td></tr>';
|
||||
sOut += '</table>';
|
||||
|
||||
return sOut;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
oTable = $('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/details_col.php",
|
||||
"aoColumns": [
|
||||
{ "sClass": "center", "bSortable": false },
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{ "sClass": "center" },
|
||||
{ "sClass": "center" }
|
||||
],
|
||||
"aaSorting": [[1, 'asc']]
|
||||
} );
|
||||
|
||||
$('#example tbody td img').live( 'click', function () {
|
||||
var nTr = $(this).parents('tr')[0];
|
||||
if ( oTable.fnIsOpen(nTr) )
|
||||
{
|
||||
/* This row is already open - close it */
|
||||
this.src = "../examples_support/details_open.png";
|
||||
oTable.fnClose( nTr );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Open this row */
|
||||
this.src = "../examples_support/details_close.png";
|
||||
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body id="dt_example">
|
||||
<div id="container">
|
||||
<div class="full_width big">
|
||||
DataTables server-side processing example with hidden row information
|
||||
</div>
|
||||
|
||||
<h1>Preamble</h1>
|
||||
<p>This example shows how you might modify the client-side show/hide details rows example for use with DataTables server-side processing option.</p>
|
||||
|
||||
<h1>Live example</h1>
|
||||
<div id="dynamic">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="4%"></th>
|
||||
<th width="25%">Rendering engine</th>
|
||||
<th width="20%">Browser</th>
|
||||
<th width="25%">Platform(s)</th>
|
||||
<th width="16%">Engine version</th>
|
||||
<th width="10%">CSS grade</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="5" class="dataTables_empty">Loading data from server</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Rendering engine</th>
|
||||
<th>Browser</th>
|
||||
<th>Platform(s)</th>
|
||||
<th>Engine version</th>
|
||||
<th>CSS grade</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
|
||||
|
||||
<h1>Initialisation code</h1>
|
||||
<pre class="brush: js;">var oTable;
|
||||
|
||||
/* Formating function for row details */
|
||||
function fnFormatDetails ( nTr )
|
||||
{
|
||||
var aData = oTable.fnGetData( nTr );
|
||||
var sOut = '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">';
|
||||
sOut += '<tr><td>Rendering engine:</td><td>'+aData[2]+' '+aData[5]+'</td></tr>';
|
||||
sOut += '<tr><td>Link to source:</td><td>Could provide a link here</td></tr>';
|
||||
sOut += '<tr><td>Extra info:</td><td>And any further details here (images etc)</td></tr>';
|
||||
sOut += '</table>';
|
||||
|
||||
return sOut;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
oTable = $('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/details_col.php",
|
||||
"aoColumns": [
|
||||
{ "sClass": "center", "bSortable": false },
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{ "sClass": "center" },
|
||||
{ "sClass": "center" }
|
||||
],
|
||||
"aaSorting": [[1, 'asc']]
|
||||
} );
|
||||
|
||||
$('#example tbody td img').live( 'click', function () {
|
||||
var nTr = $(this).parents('tr')[0];
|
||||
if ( oTable.fnIsOpen(nTr) )
|
||||
{
|
||||
/* This row is already open - close it */
|
||||
this.src = "../examples_support/details_open.png";
|
||||
oTable.fnClose( nTr );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Open this row */
|
||||
this.src = "../examples_support/details_close.png";
|
||||
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
|
||||
}
|
||||
} );
|
||||
} );</pre>
|
||||
<style type="text/css">
|
||||
@import "../examples_support/syntax/css/shCore.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
|
||||
|
||||
<h1>Server response</h1>
|
||||
<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>
|
||||
<pre id="latest_xhr" class="brush: js;"></pre>
|
||||
|
||||
|
||||
<h1>Other examples</h1>
|
||||
<div class="demo_links">
|
||||
<h2>Basic initialisation</h2>
|
||||
<ul>
|
||||
<li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
|
||||
<li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
|
||||
<li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
|
||||
<li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
|
||||
<li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
|
||||
<li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
|
||||
<li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
|
||||
<li><a href="../basic_init/dom.html">DOM positioning</a></li>
|
||||
<li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
|
||||
<li><a href="../basic_init/state_save.html">State saving</a></li>
|
||||
<li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
|
||||
<li>Scrolling: <br>
|
||||
<a href="../basic_init/scroll_x.html">Horizontal</a> /
|
||||
<a href="../basic_init/scroll_y.html">Vertical</a> /
|
||||
<a href="../basic_init/scroll_xy.html">Both</a> /
|
||||
<a href="../basic_init/scroll_y_theme.html">Themed</a> /
|
||||
<a href="../basic_init/scroll_y_infinite.html">Infinite</a>
|
||||
</li>
|
||||
<li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
|
||||
<li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Advanced initialisation</h2>
|
||||
<ul>
|
||||
<li>Events: <br>
|
||||
<a href="../advanced_init/events_live.html">Live events</a> /
|
||||
<a href="../advanced_init/events_pre_init.html">Pre-init</a> /
|
||||
<a href="../advanced_init/events_post_init.html">Post-init</a>
|
||||
</li>
|
||||
<li><a href="../advanced_init/column_render.html">Column rendering</a></li>
|
||||
<li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
|
||||
<li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
|
||||
<li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
|
||||
<li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
|
||||
<li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
|
||||
<li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
|
||||
<li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
|
||||
<li><a href="../advanced_init/row_callback.html">Row callback</a></li>
|
||||
<li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
|
||||
<li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
|
||||
<li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
|
||||
<li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
|
||||
<li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
|
||||
<li><a href="../advanced_init/dt_events.html">Custom events</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>API</h2>
|
||||
<ul>
|
||||
<li><a href="../api/add_row.html">Dynamically add a new row</a></li>
|
||||
<li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
|
||||
<li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
|
||||
<li><a href="../api/highlight.html">Highlight rows and columns</a></li>
|
||||
<li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
|
||||
<li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
|
||||
<li><a href="../api/form.html">Submit form with elements in table</a></li>
|
||||
<li><a href="../api/counter_column.html">Index column (static number column)</a></li>
|
||||
<li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
|
||||
<li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
|
||||
<li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
|
||||
<li><a href="../api/regex.html">Regular expression filtering</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="demo_links">
|
||||
<h2>Data sources</h2>
|
||||
<ul>
|
||||
<li><a href="../data_sources/dom.html">DOM</a></li>
|
||||
<li><a href="../data_sources/js_array.html">Javascript array</a></li>
|
||||
<li><a href="../data_sources/ajax.html">Ajax source</a></li>
|
||||
<li><a href="../data_sources/server_side.html">Server side processing</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Server-side processing</h2>
|
||||
<ul>
|
||||
<li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
|
||||
<li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
|
||||
<li><a href="../server_side/post.html">Use HTTP POST</a></li>
|
||||
<li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
|
||||
<li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
|
||||
<li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
|
||||
<li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
|
||||
<li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
|
||||
<li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Ajax data source</h2>
|
||||
<ul>
|
||||
<li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
|
||||
<li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
|
||||
<li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
|
||||
<li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
|
||||
<li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
|
||||
<li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
|
||||
<li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Plug-ins</h2>
|
||||
<ul>
|
||||
<li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
|
||||
<li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
|
||||
<li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
|
||||
<li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
|
||||
<li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer" class="clear" style="text-align:center;">
|
||||
<p>
|
||||
Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<span style="font-size:10px;">
|
||||
DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
|
||||
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>.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Easy set variables
|
||||
*/
|
||||
|
||||
/* Array of database columns which should be read and sent back to DataTables. Use a space where
|
||||
* you want to insert a non-database field (for example a counter or static image)
|
||||
*/
|
||||
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );
|
||||
|
||||
/* Indexed column (used for fast and accurate table cardinality) */
|
||||
$sIndexColumn = "id";
|
||||
|
||||
/* DB table to use */
|
||||
$sTable = "ajax";
|
||||
|
||||
/* Database connection information */
|
||||
$gaSql['user'] = "";
|
||||
$gaSql['password'] = "";
|
||||
$gaSql['db'] = "";
|
||||
$gaSql['server'] = "localhost";
|
||||
|
||||
/* REMOVE THIS LINE (it just includes my SQL connection user/pass) */
|
||||
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" );
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Paging
|
||||
*/
|
||||
$sLimit = "";
|
||||
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
||||
{
|
||||
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
|
||||
intval( $_GET['iDisplayLength'] );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ordering
|
||||
*/
|
||||
$sOrder = "";
|
||||
if ( isset( $_GET['iSortCol_0'] ) )
|
||||
{
|
||||
$sOrder = "ORDER BY ";
|
||||
for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
|
||||
{
|
||||
if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
|
||||
{
|
||||
$sOrder .= "`".$aColumns[ intval( $_GET['iSortCol_'.$i] ) ]."` ".
|
||||
($_GET['sSortDir_'.$i]==='asc' ? 'asc' : 'desc') .", ";
|
||||
}
|
||||
}
|
||||
|
||||
$sOrder = substr_replace( $sOrder, "", -2 );
|
||||
if ( $sOrder == "ORDER BY" )
|
||||
{
|
||||
$sOrder = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Filtering
|
||||
* NOTE this does not match the built-in DataTables filtering which does it
|
||||
* word by word on any field. It's possible to do here, but concerned about efficiency
|
||||
* on very large tables, and MySQL's regex functionality is very limited
|
||||
*/
|
||||
$sWhere = "";
|
||||
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
|
||||
{
|
||||
$sWhere = "WHERE (";
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" )
|
||||
{
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ";
|
||||
}
|
||||
}
|
||||
$sWhere = substr_replace( $sWhere, "", -3 );
|
||||
$sWhere .= ')';
|
||||
}
|
||||
|
||||
/* Individual column filtering */
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' )
|
||||
{
|
||||
if ( $sWhere == "" )
|
||||
{
|
||||
$sWhere = "WHERE ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sWhere .= " AND ";
|
||||
}
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string($_GET['sSearch_'.$i])."%' ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SQL queries
|
||||
* Get data to display
|
||||
*/
|
||||
$sQuery = "
|
||||
SELECT SQL_CALC_FOUND_ROWS ".str_replace(" , ", " ", implode(", ", $aColumns))."
|
||||
FROM $sTable
|
||||
$sWhere
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
/* Total data set length */
|
||||
$sQuery = "
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
||||
/*
|
||||
* Output
|
||||
*/
|
||||
$output = array(
|
||||
"sEcho" => intval($_GET['sEcho']),
|
||||
"iTotalRecords" => $iTotal,
|
||||
"iTotalDisplayRecords" => $iFilteredTotal,
|
||||
"test" => array()
|
||||
);
|
||||
|
||||
while ( $aRow = mysql_fetch_array( $rResult ) )
|
||||
{
|
||||
$row = array();
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( $aColumns[$i] == "version" )
|
||||
{
|
||||
/* Special output formatting for 'version' column */
|
||||
$row[] = ($aRow[ $aColumns[$i] ]=="0") ? '-' : $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
else if ( $aColumns[$i] != ' ' )
|
||||
{
|
||||
/* General output */
|
||||
$row[] = $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
}
|
||||
$output['test'][] = $row;
|
||||
}
|
||||
|
||||
echo json_encode( $output );
|
||||
?>
|
||||
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Easy set variables
|
||||
*/
|
||||
|
||||
/* Array of database columns which should be read and sent back to DataTables. Use a space where
|
||||
* you want to insert a non-database field (for example a counter or static image)
|
||||
*/
|
||||
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );
|
||||
|
||||
/* Indexed column (used for fast and accurate table cardinality) */
|
||||
$sIndexColumn = "id";
|
||||
|
||||
/* DB table to use */
|
||||
$sTable = "ajax";
|
||||
|
||||
/* Database connection information */
|
||||
$gaSql['user'] = "";
|
||||
$gaSql['password'] = "";
|
||||
$gaSql['db'] = "";
|
||||
$gaSql['server'] = "localhost";
|
||||
|
||||
/* REMOVE THIS LINE (it just includes my SQL connection user/pass) */
|
||||
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" );
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Paging
|
||||
*/
|
||||
$sLimit = "";
|
||||
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
||||
{
|
||||
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
|
||||
intval( $_GET['iDisplayLength'] );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ordering
|
||||
*/
|
||||
$sOrder = "";
|
||||
if ( isset( $_GET['iSortCol_0'] ) )
|
||||
{
|
||||
$sOrder = "ORDER BY ";
|
||||
for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
|
||||
{
|
||||
if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
|
||||
{
|
||||
$sOrder .= "`".$aColumns[ intval( $_GET['iSortCol_'.$i] ) ]."` ".
|
||||
($_GET['sSortDir_'.$i]==='asc' ? 'asc' : 'desc') .", ";
|
||||
}
|
||||
}
|
||||
|
||||
$sOrder = substr_replace( $sOrder, "", -2 );
|
||||
if ( $sOrder == "ORDER BY" )
|
||||
{
|
||||
$sOrder = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Filtering
|
||||
* NOTE this does not match the built-in DataTables filtering which does it
|
||||
* word by word on any field. It's possible to do here, but concerned about efficiency
|
||||
* on very large tables, and MySQL's regex functionality is very limited
|
||||
*/
|
||||
$sWhere = "";
|
||||
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
|
||||
{
|
||||
$sWhere = "WHERE (";
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" )
|
||||
{
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ";
|
||||
}
|
||||
}
|
||||
$sWhere = substr_replace( $sWhere, "", -3 );
|
||||
$sWhere .= ')';
|
||||
}
|
||||
|
||||
/* Individual column filtering */
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' )
|
||||
{
|
||||
if ( $sWhere == "" )
|
||||
{
|
||||
$sWhere = "WHERE ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sWhere .= " AND ";
|
||||
}
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string($_GET['sSearch_'.$i])."%' ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SQL queries
|
||||
* Get data to display
|
||||
*/
|
||||
$sQuery = "
|
||||
SELECT SQL_CALC_FOUND_ROWS ".str_replace(" , ", " ", implode(", ", $aColumns))."
|
||||
FROM $sTable
|
||||
$sWhere
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
/* Total data set length */
|
||||
$sQuery = "
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
||||
/*
|
||||
* Output
|
||||
*/
|
||||
$output = array(
|
||||
"sEcho" => intval($_GET['sEcho']),
|
||||
"iTotalRecords" => $iTotal,
|
||||
"iTotalDisplayRecords" => $iFilteredTotal,
|
||||
"aaData" => array()
|
||||
);
|
||||
|
||||
while ( $aRow = mysql_fetch_array( $rResult ) )
|
||||
{
|
||||
$row = array();
|
||||
|
||||
/* Add the details image at the start of the display array */
|
||||
$row[] = '<img src="../examples_support/details_open.png">';
|
||||
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( $aColumns[$i] == "version" )
|
||||
{
|
||||
/* Special output formatting for 'version' column */
|
||||
$row[] = ($aRow[ $aColumns[$i] ]=="0") ? '-' : $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
else if ( $aColumns[$i] != ' ' )
|
||||
{
|
||||
/* General output */
|
||||
$row[] = $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
}
|
||||
$row['extra'] = 'hrmll';
|
||||
$output['aaData'][] = $row;
|
||||
}
|
||||
|
||||
echo json_encode( $output );
|
||||
?>
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/* MySQL connection */
|
||||
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" ); /* ;-) */
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Paging */
|
||||
$sLimit = "";
|
||||
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
||||
{
|
||||
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
|
||||
intval( $_GET['iDisplayLength'] );
|
||||
}
|
||||
|
||||
/* Ordering */
|
||||
if ( isset( $_GET['iSortCol_0'] ) )
|
||||
{
|
||||
$sOrder = "ORDER BY ";
|
||||
for ( $i=0 ; $i<mysql_real_escape_string( $_GET['iSortingCols'] ) ; $i++ )
|
||||
{
|
||||
$sOrder .= fnColumnToField(mysql_real_escape_string( $_GET['iSortCol_'.$i] ))."
|
||||
".mysql_real_escape_string( $_GET['sSortDir_'.$i] ) .", ";
|
||||
}
|
||||
$sOrder = substr_replace( $sOrder, "", -2 );
|
||||
}
|
||||
|
||||
/* Filtering - NOTE this does not match the built-in DataTables filtering which does it
|
||||
* word by word on any field. It's possible to do here, but concerned about efficiency
|
||||
* on very large tables, and MySQL's regex functionality is very limited
|
||||
*/
|
||||
$sWhere = "";
|
||||
if ( $_GET['sSearch'] != "" )
|
||||
{
|
||||
$sWhere = "WHERE ( engine LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ".
|
||||
"browser LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ".
|
||||
"platform LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ".
|
||||
"version LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ".
|
||||
"grade LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' )";
|
||||
}
|
||||
|
||||
for ( $i=0 ; $i<$_GET['iColumns'] ; $i++ )
|
||||
{
|
||||
if ( $_GET['sSearch_'.$i] != '' )
|
||||
{
|
||||
if ( $sWhere != "" )
|
||||
{
|
||||
$sWhere .= " AND ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sWhere .= "WHERE ";
|
||||
}
|
||||
$sWhere .= fnColumnToField($i) ." LIKE '%".mysql_real_escape_string( $_GET['sSearch_'.$i] )."%'";
|
||||
}
|
||||
}
|
||||
|
||||
$sQuery = "
|
||||
SELECT SQL_CALC_FOUND_ROWS id, engine, browser, platform, version, grade
|
||||
FROM ajax
|
||||
$sWhere
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
$sQuery = "
|
||||
SELECT COUNT(id)
|
||||
FROM ajax
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
$sOutput = '{';
|
||||
$sOutput .= '"sEcho": '.intval($_GET['sEcho']).', ';
|
||||
$sOutput .= '"iTotalRecords": '.$iTotal.', ';
|
||||
$sOutput .= '"iTotalDisplayRecords": '.$iFilteredTotal.', ';
|
||||
$sOutput .= '"aaData": [ ';
|
||||
while ( $aRow = mysql_fetch_array( $rResult ) )
|
||||
{
|
||||
$sOutput .= "[";
|
||||
$sOutput .= '"'.str_replace('"', '\"', $aRow['engine']).'",';
|
||||
$sOutput .= '"'.str_replace('"', '\"', $aRow['browser']).'",';
|
||||
$sOutput .= '"'.str_replace('"', '\"', $aRow['platform']).'",';
|
||||
if ( $aRow['version'] == "0" )
|
||||
$sOutput .= '"-",';
|
||||
else
|
||||
$sOutput .= '"'.str_replace('"', '\"', $aRow['version']).'",';
|
||||
$sOutput .= '"'.str_replace('"', '\"', $aRow['grade']).'"';
|
||||
$sOutput .= "],";
|
||||
}
|
||||
$sOutput = substr_replace( $sOutput, "", -1 );
|
||||
$sOutput .= '] }';
|
||||
|
||||
echo $sOutput;
|
||||
|
||||
|
||||
function fnColumnToField( $i )
|
||||
{
|
||||
if ( $i == 0 )
|
||||
return "engine";
|
||||
else if ( $i == 1 )
|
||||
return "browser";
|
||||
else if ( $i == 2 )
|
||||
return "platform";
|
||||
else if ( $i == 3 )
|
||||
return "version";
|
||||
else if ( $i == 4 )
|
||||
return "grade";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Easy set variables
|
||||
*/
|
||||
|
||||
/* Array of database columns which should be read and sent back to DataTables. Use a space where
|
||||
* you want to insert a non-database field (for example a counter or static image)
|
||||
*/
|
||||
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );
|
||||
|
||||
/* Indexed column (used for fast and accurate table cardinality) */
|
||||
$sIndexColumn = "id";
|
||||
|
||||
/* DB table to use */
|
||||
$sTable = "ajax";
|
||||
|
||||
/* Database connection information */
|
||||
$gaSql['user'] = "";
|
||||
$gaSql['password'] = "";
|
||||
$gaSql['db'] = "";
|
||||
$gaSql['server'] = "localhost";
|
||||
|
||||
/* REMOVE THIS LINE (it just includes my SQL connection user/pass) */
|
||||
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" );
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Paging
|
||||
*/
|
||||
$sLimit = "";
|
||||
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
||||
{
|
||||
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
|
||||
intval( $_GET['iDisplayLength'] );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ordering
|
||||
*/
|
||||
$sOrder = "";
|
||||
if ( isset( $_GET['iSortCol_0'] ) )
|
||||
{
|
||||
$sOrder = "ORDER BY ";
|
||||
for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
|
||||
{
|
||||
if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
|
||||
{
|
||||
$sOrder .= "`".$aColumns[ intval( $_GET['iSortCol_'.$i] ) ]."` ".
|
||||
($_GET['sSortDir_'.$i]==='asc' ? 'asc' : 'desc') .", ";
|
||||
}
|
||||
}
|
||||
|
||||
$sOrder = substr_replace( $sOrder, "", -2 );
|
||||
if ( $sOrder == "ORDER BY" )
|
||||
{
|
||||
$sOrder = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Filtering
|
||||
* NOTE this does not match the built-in DataTables filtering which does it
|
||||
* word by word on any field. It's possible to do here, but concerned about efficiency
|
||||
* on very large tables, and MySQL's regex functionality is very limited
|
||||
*/
|
||||
$sWhere = "";
|
||||
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
|
||||
{
|
||||
$sWhere = "WHERE (";
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" )
|
||||
{
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ";
|
||||
}
|
||||
}
|
||||
$sWhere = substr_replace( $sWhere, "", -3 );
|
||||
$sWhere .= ')';
|
||||
}
|
||||
|
||||
/* Individual column filtering */
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' )
|
||||
{
|
||||
if ( $sWhere == "" )
|
||||
{
|
||||
$sWhere = "WHERE ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sWhere .= " AND ";
|
||||
}
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string($_GET['sSearch_'.$i])."%' ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SQL queries
|
||||
* Get data to display
|
||||
*/
|
||||
$sQuery = "
|
||||
SELECT SQL_CALC_FOUND_ROWS id, ".str_replace(" , ", " ", implode(", ", $aColumns))."
|
||||
FROM $sTable
|
||||
$sWhere
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
/* Total data set length */
|
||||
$sQuery = "
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
||||
/*
|
||||
* Output
|
||||
*/
|
||||
$output = array(
|
||||
"sEcho" => intval($_GET['sEcho']),
|
||||
"iTotalRecords" => $iTotal,
|
||||
"iTotalDisplayRecords" => $iFilteredTotal,
|
||||
"aaData" => array()
|
||||
);
|
||||
|
||||
while ( $aRow = mysql_fetch_array( $rResult ) )
|
||||
{
|
||||
$row = array();
|
||||
|
||||
// Add the row ID and class to the object
|
||||
$row['DT_RowId'] = 'row_'.$aRow['id'];
|
||||
$row['DT_RowClass'] = 'grade'.$aRow['grade'];
|
||||
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( $aColumns[$i] == "version" )
|
||||
{
|
||||
/* Special output formatting for 'version' column */
|
||||
$row[] = ($aRow[ $aColumns[$i] ]=="0") ? '-' : $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
else if ( $aColumns[$i] != ' ' )
|
||||
{
|
||||
/* General output */
|
||||
$row[] = $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
}
|
||||
$output['aaData'][] = $row;
|
||||
}
|
||||
|
||||
echo json_encode( $output );
|
||||
?>
|
||||
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Easy set variables
|
||||
*/
|
||||
|
||||
/* Array of database columns which should be read and sent back to DataTables. Use a space where
|
||||
* you want to insert a non-database field (for example a counter or static image)
|
||||
*/
|
||||
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );
|
||||
|
||||
/* Indexed column (used for fast and accurate table cardinality) */
|
||||
$sIndexColumn = "id";
|
||||
|
||||
/* DB table to use */
|
||||
$sTable = "ajax";
|
||||
|
||||
/* Database connection information */
|
||||
$gaSql['user'] = "";
|
||||
$gaSql['password'] = "";
|
||||
$gaSql['db'] = "";
|
||||
$gaSql['server'] = "localhost";
|
||||
|
||||
/* REMOVE THIS LINE (it just includes my SQL connection user/pass) */
|
||||
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" );
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Paging
|
||||
*/
|
||||
$sLimit = "";
|
||||
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
||||
{
|
||||
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
|
||||
intval( $_GET['iDisplayLength'] );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ordering
|
||||
*/
|
||||
$sOrder = "";
|
||||
if ( isset( $_GET['iSortCol_0'] ) )
|
||||
{
|
||||
$sOrder = "ORDER BY ";
|
||||
for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
|
||||
{
|
||||
if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
|
||||
{
|
||||
$sOrder .= "`".$aColumns[ intval( $_GET['iSortCol_'.$i] ) ]."` ".
|
||||
($_GET['sSortDir_'.$i]==='asc' ? 'asc' : 'desc') .", ";
|
||||
}
|
||||
}
|
||||
|
||||
$sOrder = substr_replace( $sOrder, "", -2 );
|
||||
if ( $sOrder == "ORDER BY" )
|
||||
{
|
||||
$sOrder = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Filtering
|
||||
* NOTE this does not match the built-in DataTables filtering which does it
|
||||
* word by word on any field. It's possible to do here, but concerned about efficiency
|
||||
* on very large tables, and MySQL's regex functionality is very limited
|
||||
*/
|
||||
$sWhere = "";
|
||||
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
|
||||
{
|
||||
$sWhere = "WHERE (";
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" )
|
||||
{
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ";
|
||||
}
|
||||
}
|
||||
$sWhere = substr_replace( $sWhere, "", -3 );
|
||||
$sWhere .= ')';
|
||||
}
|
||||
|
||||
/* Individual column filtering */
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' )
|
||||
{
|
||||
if ( $sWhere == "" )
|
||||
{
|
||||
$sWhere = "WHERE ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sWhere .= " AND ";
|
||||
}
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string($_GET['sSearch_'.$i])."%' ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SQL queries
|
||||
* Get data to display
|
||||
*/
|
||||
$sQuery = "
|
||||
SELECT SQL_CALC_FOUND_ROWS id, ".str_replace(" , ", " ", implode(", ", $aColumns))."
|
||||
FROM $sTable
|
||||
$sWhere
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
/* Total data set length */
|
||||
$sQuery = "
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
||||
/*
|
||||
* Output
|
||||
*/
|
||||
$output = array(
|
||||
"sEcho" => intval($_GET['sEcho']),
|
||||
"iTotalRecords" => $iTotal,
|
||||
"iTotalDisplayRecords" => $iFilteredTotal,
|
||||
"aaData" => array()
|
||||
);
|
||||
|
||||
while ( $aRow = mysql_fetch_array( $rResult ) )
|
||||
{
|
||||
$row = array();
|
||||
|
||||
// Add the row ID and class to the object
|
||||
$row['DT_RowId'] = 'row_'.$aRow['id'];
|
||||
$row['DT_RowClass'] = 'grade'.$aRow['grade'];
|
||||
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( $aColumns[$i] == "version" )
|
||||
{
|
||||
/* Special output formatting for 'version' column */
|
||||
$row[] = ($aRow[ $aColumns[$i] ]=="0") ? '-' : $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
else if ( $aColumns[$i] != ' ' )
|
||||
{
|
||||
/* General output */
|
||||
$row[] = $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
}
|
||||
$output['aaData'][] = $row;
|
||||
}
|
||||
|
||||
echo $_GET['callback'].'('.json_encode( $output ).');';
|
||||
?>
|
||||
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Easy set variables
|
||||
*/
|
||||
|
||||
/* Array of database columns which should be read and sent back to DataTables. Use a space where
|
||||
* you want to insert a non-database field (for example a counter or static image)
|
||||
*/
|
||||
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );
|
||||
|
||||
/* Indexed column (used for fast and accurate table cardinality) */
|
||||
$sIndexColumn = "id";
|
||||
|
||||
/* DB table to use */
|
||||
$sTable = "ajax";
|
||||
|
||||
/* Database connection information */
|
||||
$gaSql['user'] = "";
|
||||
$gaSql['password'] = "";
|
||||
$gaSql['db'] = "";
|
||||
$gaSql['server'] = "localhost";
|
||||
|
||||
/* REMOVE THIS LINE (it just includes my SQL connection user/pass) */
|
||||
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" );
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Paging
|
||||
*/
|
||||
$sLimit = "";
|
||||
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
||||
{
|
||||
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
|
||||
intval( $_GET['iDisplayLength'] );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ordering
|
||||
*/
|
||||
$sOrder = "";
|
||||
if ( isset( $_GET['iSortCol_0'] ) )
|
||||
{
|
||||
$sOrder = "ORDER BY ";
|
||||
for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
|
||||
{
|
||||
if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
|
||||
{
|
||||
$sOrder .= "`".$aColumns[ intval( $_GET['iSortCol_'.$i] ) ]."` ".
|
||||
($_GET['sSortDir_'.$i]==='asc' ? 'asc' : 'desc') .", ";
|
||||
}
|
||||
}
|
||||
|
||||
$sOrder = substr_replace( $sOrder, "", -2 );
|
||||
if ( $sOrder == "ORDER BY" )
|
||||
{
|
||||
$sOrder = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Filtering
|
||||
* NOTE this does not match the built-in DataTables filtering which does it
|
||||
* word by word on any field. It's possible to do here, but concerned about efficiency
|
||||
* on very large tables, and MySQL's regex functionality is very limited
|
||||
*/
|
||||
$sWhere = "";
|
||||
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
|
||||
{
|
||||
$sWhere = "WHERE (";
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" )
|
||||
{
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ";
|
||||
}
|
||||
}
|
||||
$sWhere = substr_replace( $sWhere, "", -3 );
|
||||
$sWhere .= ')';
|
||||
}
|
||||
|
||||
/* Individual column filtering */
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' )
|
||||
{
|
||||
if ( $sWhere == "" )
|
||||
{
|
||||
$sWhere = "WHERE ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sWhere .= " AND ";
|
||||
}
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string($_GET['sSearch_'.$i])."%' ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SQL queries
|
||||
* Get data to display
|
||||
*/
|
||||
$sQuery = "
|
||||
SELECT SQL_CALC_FOUND_ROWS ".str_replace(" , ", " ", implode(", ", $aColumns))."
|
||||
FROM $sTable
|
||||
$sWhere
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
/* Total data set length */
|
||||
$sQuery = "
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
||||
/*
|
||||
* Output
|
||||
*/
|
||||
$output = array(
|
||||
"sEcho" => intval($_GET['sEcho']),
|
||||
"iTotalRecords" => $iTotal,
|
||||
"iTotalDisplayRecords" => $iFilteredTotal,
|
||||
"aaData" => array()
|
||||
);
|
||||
|
||||
while ( $aRow = mysql_fetch_array( $rResult ) )
|
||||
{
|
||||
$row = array();
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( $aColumns[$i] == "version" )
|
||||
{
|
||||
/* Special output formatting for 'version' column */
|
||||
$row[] = ($aRow[ $aColumns[$i] ]=="0") ? '-' : $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
else if ( $aColumns[$i] != ' ' )
|
||||
{
|
||||
/* General output */
|
||||
$row[] = $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
}
|
||||
$output['aaData'][] = $row;
|
||||
}
|
||||
|
||||
echo $_GET['callback'].'('.json_encode( $output ).');';
|
||||
?>
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Easy set variables
|
||||
*/
|
||||
|
||||
/* Array of database columns which should be read and sent back to DataTables. Use a space where
|
||||
* you want to insert a non-database field (for example a counter or static image)
|
||||
*/
|
||||
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );
|
||||
|
||||
/* Indexed column (used for fast and accurate table cardinality) */
|
||||
$sIndexColumn = "id";
|
||||
|
||||
/* DB table to use */
|
||||
$sTable = "ajax";
|
||||
|
||||
/* Database connection information */
|
||||
$gaSql['user'] = "";
|
||||
$gaSql['password'] = "";
|
||||
$gaSql['db'] = "";
|
||||
$gaSql['server'] = "localhost";
|
||||
|
||||
/* REMOVE THIS LINE (it just includes my SQL connection user/pass) */
|
||||
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" );
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Paging
|
||||
*/
|
||||
$sLimit = "";
|
||||
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
||||
{
|
||||
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
|
||||
intval( $_GET['iDisplayLength'] );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ordering
|
||||
*/
|
||||
$sOrder = "";
|
||||
if ( isset( $_GET['iSortCol_0'] ) )
|
||||
{
|
||||
$sOrder = "ORDER BY ";
|
||||
for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
|
||||
{
|
||||
if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
|
||||
{
|
||||
$iColumnIndex = array_search( $_GET['mDataProp_'.$_GET['iSortCol_'.$i]], $aColumns );
|
||||
$sOrder .= "`".$aColumns[ $iColumnIndex ]."` ".
|
||||
($_GET['sSortDir_'.$i]==='asc' ? 'asc' : 'desc') .", ";
|
||||
}
|
||||
}
|
||||
|
||||
$sOrder = substr_replace( $sOrder, "", -2 );
|
||||
if ( $sOrder == "ORDER BY" )
|
||||
{
|
||||
$sOrder = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Filtering
|
||||
* NOTE this does not match the built-in DataTables filtering which does it
|
||||
* word by word on any field. It's possible to do here, but concerned about efficiency
|
||||
* on very large tables, and MySQL's regex functionality is very limited
|
||||
*/
|
||||
$sWhere = "";
|
||||
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
|
||||
{
|
||||
$sWhere = "WHERE (";
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" )
|
||||
{
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ";
|
||||
}
|
||||
}
|
||||
$sWhere = substr_replace( $sWhere, "", -3 );
|
||||
$sWhere .= ')';
|
||||
}
|
||||
|
||||
/* Individual column filtering */
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' )
|
||||
{
|
||||
if ( $sWhere == "" )
|
||||
{
|
||||
$sWhere = "WHERE ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sWhere .= " AND ";
|
||||
}
|
||||
$iColumnIndex = array_search( $_GET['mDataProp_'.$i], $aColumns );
|
||||
$sWhere .= $aColumns[$iColumnIndex]." LIKE '%".mysql_real_escape_string($_GET['sSearch_'.$i])."%' ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SQL queries
|
||||
* Get data to display
|
||||
*/
|
||||
$sQuery = "
|
||||
SELECT SQL_CALC_FOUND_ROWS ".str_replace(" , ", " ", implode(", ", $aColumns))."
|
||||
FROM $sTable
|
||||
$sWhere
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
/* Total data set length */
|
||||
$sQuery = "
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
||||
/*
|
||||
* Output
|
||||
*/
|
||||
$output = array(
|
||||
"sEcho" => intval($_GET['sEcho']),
|
||||
"iTotalRecords" => $iTotal,
|
||||
"iTotalDisplayRecords" => $iFilteredTotal,
|
||||
"aaData" => array()
|
||||
);
|
||||
|
||||
while ( $aRow = mysql_fetch_array( $rResult ) )
|
||||
{
|
||||
$row = array();
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( $aColumns[$i] == "version" )
|
||||
{
|
||||
/* Special output formatting for 'version' column */
|
||||
$row[ $aColumns[$i] ] = ($aRow[ $aColumns[$i] ]=="0") ? '-' : $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
else if ( $aColumns[$i] != ' ' )
|
||||
{
|
||||
/* General output */
|
||||
$row[ $aColumns[$i] ] = $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
}
|
||||
$output['aaData'][] = $row;
|
||||
}
|
||||
|
||||
echo json_encode( $output );
|
||||
?>
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Easy set variables
|
||||
*/
|
||||
|
||||
/* Array of database columns which should be read and sent back to DataTables. Use a space where
|
||||
* you want to insert a non-database field (for example a counter or static image)
|
||||
*/
|
||||
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );
|
||||
|
||||
/* Indexed column (used for fast and accurate table cardinality) */
|
||||
$sIndexColumn = "id";
|
||||
|
||||
/* DB table to use */
|
||||
$sTable = "ajax";
|
||||
|
||||
/* Database connection information */
|
||||
$gaSql['user'] = "";
|
||||
$gaSql['password'] = "";
|
||||
$gaSql['db'] = "";
|
||||
$gaSql['server'] = "localhost";
|
||||
|
||||
/* REMOVE THIS LINE (it just includes my SQL connection user/pass) */
|
||||
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" );
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Paging
|
||||
*/
|
||||
$sLimit = "";
|
||||
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
||||
{
|
||||
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
|
||||
intval( $_GET['iDisplayLength'] );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ordering
|
||||
*/
|
||||
$sOrder = "";
|
||||
if ( isset( $_GET['iSortCol_0'] ) )
|
||||
{
|
||||
$sOrder = "ORDER BY ";
|
||||
for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
|
||||
{
|
||||
if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
|
||||
{
|
||||
$iColumnIndex = array_search( $_GET['mDataProp_'.$_GET['iSortCol_'.$i]], $aColumns );
|
||||
$sOrder .= "`".$aColumns[ $iColumnIndex ]."` ".
|
||||
($_GET['sSortDir_'.$i]==='asc' ? 'asc' : 'desc') .", ";
|
||||
}
|
||||
}
|
||||
|
||||
$sOrder = substr_replace( $sOrder, "", -2 );
|
||||
if ( $sOrder == "ORDER BY" )
|
||||
{
|
||||
$sOrder = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Filtering
|
||||
* NOTE this does not match the built-in DataTables filtering which does it
|
||||
* word by word on any field. It's possible to do here, but concerned about efficiency
|
||||
* on very large tables, and MySQL's regex functionality is very limited
|
||||
*/
|
||||
$sWhere = "";
|
||||
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
|
||||
{
|
||||
$sWhere = "WHERE (";
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" )
|
||||
{
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ";
|
||||
}
|
||||
}
|
||||
$sWhere = substr_replace( $sWhere, "", -3 );
|
||||
$sWhere .= ')';
|
||||
}
|
||||
|
||||
/* Individual column filtering */
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' )
|
||||
{
|
||||
if ( $sWhere == "" )
|
||||
{
|
||||
$sWhere = "WHERE ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sWhere .= " AND ";
|
||||
}
|
||||
$iColumnIndex = array_search( $_GET['mDataProp_'.$i], $aColumns );
|
||||
$sWhere .= $aColumns[$iColumnIndex]." LIKE '%".mysql_real_escape_string($_GET['sSearch_'.$i])."%' ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SQL queries
|
||||
* Get data to display
|
||||
*/
|
||||
$sQuery = "
|
||||
SELECT SQL_CALC_FOUND_ROWS ".str_replace(" , ", " ", implode(", ", $aColumns))."
|
||||
FROM $sTable
|
||||
$sWhere
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
/* Total data set length */
|
||||
$sQuery = "
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
||||
/*
|
||||
* Output
|
||||
*/
|
||||
$output = array(
|
||||
"sEcho" => intval($_GET['sEcho']),
|
||||
"iTotalRecords" => $iTotal,
|
||||
"iTotalDisplayRecords" => $iFilteredTotal,
|
||||
"aaData" => array()
|
||||
);
|
||||
|
||||
while ( $aRow = mysql_fetch_array( $rResult ) )
|
||||
{
|
||||
$row = array();
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( $aColumns[$i] == "version" )
|
||||
{
|
||||
/* Special output formatting for 'version' column */
|
||||
$row[ $aColumns[$i] ] = ($aRow[ $aColumns[$i] ]=="0") ? '-' : $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
else if ( $aColumns[$i] != ' ' )
|
||||
{
|
||||
/* General output */
|
||||
$row[ $aColumns[$i] ] = $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
}
|
||||
$output['aaData'][] = $row;
|
||||
}
|
||||
|
||||
echo $_GET['callback'].'('.json_encode( $output ).');';
|
||||
?>
|
||||
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Easy set variables
|
||||
*/
|
||||
|
||||
/* Array of database columns which should be read and sent back to DataTables. Use a space where
|
||||
* you want to insert a non-database field (for example a counter or static image)
|
||||
*/
|
||||
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );
|
||||
|
||||
/* Indexed column (used for fast and accurate table cardinality) */
|
||||
$sIndexColumn = "id";
|
||||
|
||||
/* DB table to use */
|
||||
$sTable = "ajax";
|
||||
|
||||
/* Database connection information */
|
||||
$gaSql['user'] = "";
|
||||
$gaSql['password'] = "";
|
||||
$gaSql['db'] = "";
|
||||
$gaSql['server'] = "localhost";
|
||||
|
||||
/* REMOVE THIS LINE (it just includes my SQL connection user/pass) */
|
||||
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" );
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Paging
|
||||
*/
|
||||
$sLimit = "";
|
||||
if ( isset( $_POST['iDisplayStart'] ) && $_POST['iDisplayLength'] != '-1' )
|
||||
{
|
||||
$sLimit = "LIMIT ".intval( $_POST['iDisplayStart'] ).", ".
|
||||
intval( $_POST['iDisplayLength'] );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ordering
|
||||
*/
|
||||
if ( isset( $_POST['iSortCol_0'] ) )
|
||||
{
|
||||
$sOrder = "ORDER BY ";
|
||||
for ( $i=0 ; $i<intval( $_POST['iSortingCols'] ) ; $i++ )
|
||||
{
|
||||
if ( $_POST[ 'bSortable_'.intval($_POST['iSortCol_'.$i]) ] == "true" )
|
||||
{
|
||||
$sOrder .= "`".$aColumns[ intval( $_POST['iSortCol_'.$i] ) ]."` ".
|
||||
($_POST['sSortDir_'.$i]==='asc' ? 'asc' : 'desc') .", ";
|
||||
}
|
||||
}
|
||||
|
||||
$sOrder = substr_replace( $sOrder, "", -2 );
|
||||
if ( $sOrder == "ORDER BY" )
|
||||
{
|
||||
$sOrder = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Filtering
|
||||
* NOTE this does not match the built-in DataTables filtering which does it
|
||||
* word by word on any field. It's possible to do here, but concerned about efficiency
|
||||
* on very large tables, and MySQL's regex functionality is very limited
|
||||
*/
|
||||
$sWhere = "";
|
||||
if ( $_POST['sSearch'] != "" )
|
||||
{
|
||||
$sWhere = "WHERE (";
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_POST['bSearchable_'.$i]) && $_POST['bSearchable_'.$i] == "true" )
|
||||
{
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string( $_POST['sSearch'] )."%' OR ";
|
||||
}
|
||||
}
|
||||
$sWhere = substr_replace( $sWhere, "", -3 );
|
||||
$sWhere .= ')';
|
||||
}
|
||||
|
||||
/* Individual column filtering */
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( $_POST['bSearchable_'.$i] == "true" && $_POST['sSearch_'.$i] != '' )
|
||||
{
|
||||
if ( $sWhere == "" )
|
||||
{
|
||||
$sWhere = "WHERE ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sWhere .= " AND ";
|
||||
}
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string($_POST['sSearch_'.$i])."%' ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SQL queries
|
||||
* Get data to display
|
||||
*/
|
||||
$sQuery = "
|
||||
SELECT SQL_CALC_FOUND_ROWS ".str_replace(" , ", " ", implode(", ", $aColumns))."
|
||||
FROM $sTable
|
||||
$sWhere
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
/* Total data set length */
|
||||
$sQuery = "
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
||||
/*
|
||||
* Output
|
||||
*/
|
||||
$sOutput = '{';
|
||||
$sOutput .= '"sEcho": '.intval($_POST['sEcho']).', ';
|
||||
$sOutput .= '"iTotalRecords": '.$iTotal.', ';
|
||||
$sOutput .= '"iTotalDisplayRecords": '.$iFilteredTotal.', ';
|
||||
$sOutput .= '"aaData": [ ';
|
||||
while ( $aRow = mysql_fetch_array( $rResult ) )
|
||||
{
|
||||
$sOutput .= "[";
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( $aColumns[$i] == "version" )
|
||||
{
|
||||
/* Special output formatting for 'version' */
|
||||
$sOutput .= ($aRow[ $aColumns[$i] ]=="0") ?
|
||||
'"-",' :
|
||||
'"'.str_replace('"', '\"', $aRow[ $aColumns[$i] ]).'",';
|
||||
}
|
||||
else if ( $aColumns[$i] != ' ' )
|
||||
{
|
||||
/* General output */
|
||||
$sOutput .= '"'.str_replace('"', '\"', $aRow[ $aColumns[$i] ]).'",';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Optional Configuration:
|
||||
* If you need to add any extra columns (add/edit/delete etc) to the table, that aren't in the
|
||||
* database - you can do it here
|
||||
*/
|
||||
|
||||
|
||||
$sOutput = substr_replace( $sOutput, "", -1 );
|
||||
$sOutput .= "],";
|
||||
}
|
||||
$sOutput = substr_replace( $sOutput, "", -1 );
|
||||
$sOutput .= '] }';
|
||||
|
||||
echo $sOutput;
|
||||
?>
|
||||
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Easy set variables
|
||||
*/
|
||||
|
||||
/* Array of database columns which should be read and sent back to DataTables. Use a space where
|
||||
* you want to insert a non-database field (for example a counter or static image)
|
||||
*/
|
||||
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );
|
||||
|
||||
/* Indexed column (used for fast and accurate table cardinality) */
|
||||
$sIndexColumn = "id";
|
||||
|
||||
/* DB table to use */
|
||||
$sTable = "ajax";
|
||||
|
||||
/* Database connection information */
|
||||
$gaSql['user'] = "";
|
||||
$gaSql['password'] = "";
|
||||
$gaSql['db'] = "";
|
||||
$gaSql['server'] = "localhost";
|
||||
|
||||
/* REMOVE THIS LINE (it just includes my SQL connection user/pass) */
|
||||
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" );
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
/*
|
||||
* Paging
|
||||
*/
|
||||
$sLimit = "";
|
||||
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
||||
{
|
||||
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
|
||||
intval( $_GET['iDisplayLength'] );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ordering
|
||||
*/
|
||||
$sOrder = "";
|
||||
if ( isset( $_GET['iSortCol_0'] ) )
|
||||
{
|
||||
$sOrder = "ORDER BY ";
|
||||
for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
|
||||
{
|
||||
if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
|
||||
{
|
||||
$sOrder .= "`".$aColumns[ intval( $_GET['iSortCol_'.$i] ) ]."` ".
|
||||
($_GET['sSortDir_'.$i]==='asc' ? 'asc' : 'desc') .", ";
|
||||
}
|
||||
}
|
||||
|
||||
$sOrder = substr_replace( $sOrder, "", -2 );
|
||||
if ( $sOrder == "ORDER BY" )
|
||||
{
|
||||
$sOrder = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Filtering
|
||||
* NOTE this does not match the built-in DataTables filtering which does it
|
||||
* word by word on any field. It's possible to do here, but concerned about efficiency
|
||||
* on very large tables, and MySQL's regex functionality is very limited
|
||||
*/
|
||||
$sWhere = "";
|
||||
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
|
||||
{
|
||||
$sWhere = "WHERE (";
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" )
|
||||
{
|
||||
$sWhere .= "`".$aColumns[$i]."` LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ";
|
||||
}
|
||||
}
|
||||
$sWhere = substr_replace( $sWhere, "", -3 );
|
||||
$sWhere .= ')';
|
||||
}
|
||||
|
||||
/* Individual column filtering */
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' )
|
||||
{
|
||||
if ( $sWhere == "" )
|
||||
{
|
||||
$sWhere = "WHERE ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sWhere .= " AND ";
|
||||
}
|
||||
$sWhere .= "`".$aColumns[$i]."` LIKE '%".mysql_real_escape_string($_GET['sSearch_'.$i])."%' ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SQL queries
|
||||
* Get data to display
|
||||
*/
|
||||
$sQuery = "
|
||||
SELECT SQL_CALC_FOUND_ROWS `".str_replace(" , ", " ", implode("`, `", $aColumns))."`
|
||||
FROM $sTable
|
||||
$sWhere
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
/* Total data set length */
|
||||
$sQuery = "
|
||||
SELECT COUNT(`".$sIndexColumn."`)
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
||||
/*
|
||||
* Output
|
||||
*/
|
||||
$output = array(
|
||||
"sEcho" => intval($_GET['sEcho']),
|
||||
"iTotalRecords" => $iTotal,
|
||||
"iTotalDisplayRecords" => $iFilteredTotal,
|
||||
"aaData" => array()
|
||||
);
|
||||
|
||||
while ( $aRow = mysql_fetch_array( $rResult ) )
|
||||
{
|
||||
$row = array();
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( $aColumns[$i] == "version" )
|
||||
{
|
||||
/* Special output formatting for 'version' column */
|
||||
$row[] = ($aRow[ $aColumns[$i] ]=="0") ? '-' : $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
else if ( $aColumns[$i] != ' ' )
|
||||
{
|
||||
/* General output */
|
||||
$row[] = $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
}
|
||||
$output['aaData'][] = $row;
|
||||
}
|
||||
|
||||
echo json_encode( $output );
|
||||
?>
|
||||
@@ -0,0 +1,256 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
|
||||
|
||||
<title>DataTables example</title>
|
||||
<style type="text/css" title="currentStyle">
|
||||
@import "../../media/css/demo_page.css";
|
||||
@import "../../media/css/demo_table.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(document).ready(function() {
|
||||
var aSelected = [];
|
||||
|
||||
/* Init the table */
|
||||
$("#example").dataTable({
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/id.php",
|
||||
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
|
||||
if ( jQuery.inArray(aData.DT_RowId, aSelected) !== -1 ) {
|
||||
$(nRow).addClass('row_selected');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* Click event handler */
|
||||
$('#example tbody tr').live('click', function () {
|
||||
var id = this.id;
|
||||
var index = jQuery.inArray(id, aSelected);
|
||||
|
||||
if ( index === -1 ) {
|
||||
aSelected.push( id );
|
||||
} else {
|
||||
aSelected.splice( index, 1 );
|
||||
}
|
||||
|
||||
$(this).toggleClass('row_selected');
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body id="dt_example">
|
||||
<div id="container">
|
||||
<div class="full_width big">
|
||||
DataTables server-side processing with user selectable rows example
|
||||
</div>
|
||||
|
||||
<h1>Preamble</h1>
|
||||
<p>When you want to detail with user selectable rows and DataTables, it is relatively simple when using DOM based data - but if using server-side processing, DataTables doesn't retain state over pages / filters etc, leaving this to the server-side instead. As such, you will need to keep a track of which rows a user as selected and mark them as selected on each draw. This is shown in this demo, which uses a unique ID assigned to the TR element (this is done automatically through the use of the <i>DT_RowId</i> special property returned as part of the object given by the server for each row).</p>
|
||||
|
||||
<h1>Live example</h1>
|
||||
<div id="dynamic">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">Rendering engine</th>
|
||||
<th width="25%">Browser</th>
|
||||
<th width="25%">Platform(s)</th>
|
||||
<th width="15%">Engine version</th>
|
||||
<th width="15%">CSS grade</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="5" class="dataTables_empty">Loading data from server</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Rendering engine</th>
|
||||
<th>Browser</th>
|
||||
<th>Platform(s)</th>
|
||||
<th>Engine version</th>
|
||||
<th>CSS grade</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
|
||||
|
||||
<h1>Initialisation code</h1>
|
||||
<pre class="brush: js;">$(document).ready(function() {
|
||||
var aSelected = [];
|
||||
|
||||
/* Init the table */
|
||||
$("#example").dataTable({
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/id.php",
|
||||
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
|
||||
if ( jQuery.inArray(aData.DT_RowId, aSelected) !== -1 ) {
|
||||
$(nRow).addClass('row_selected');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* Click event handler */
|
||||
$('#example tbody tr').live('click', function () {
|
||||
var id = this.id;
|
||||
var index = jQuery.inArray(id, aSelected);
|
||||
|
||||
if ( index === -1 ) {
|
||||
aSelected.push( id );
|
||||
} else {
|
||||
aSelected.splice( index, 1 );
|
||||
}
|
||||
|
||||
$(this).toggleClass('row_selected');
|
||||
} );
|
||||
} );</pre>
|
||||
<style type="text/css">
|
||||
@import "../examples_support/syntax/css/shCore.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
|
||||
|
||||
<h1>Server response</h1>
|
||||
<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>
|
||||
<pre id="latest_xhr" class="brush: js;"></pre>
|
||||
|
||||
|
||||
<h1>Other examples</h1>
|
||||
<div class="demo_links">
|
||||
<h2>Basic initialisation</h2>
|
||||
<ul>
|
||||
<li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
|
||||
<li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
|
||||
<li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
|
||||
<li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
|
||||
<li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
|
||||
<li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
|
||||
<li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
|
||||
<li><a href="../basic_init/dom.html">DOM positioning</a></li>
|
||||
<li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
|
||||
<li><a href="../basic_init/state_save.html">State saving</a></li>
|
||||
<li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
|
||||
<li>Scrolling: <br>
|
||||
<a href="../basic_init/scroll_x.html">Horizontal</a> /
|
||||
<a href="../basic_init/scroll_y.html">Vertical</a> /
|
||||
<a href="../basic_init/scroll_xy.html">Both</a> /
|
||||
<a href="../basic_init/scroll_y_theme.html">Themed</a> /
|
||||
<a href="../basic_init/scroll_y_infinite.html">Infinite</a>
|
||||
</li>
|
||||
<li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
|
||||
<li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Advanced initialisation</h2>
|
||||
<ul>
|
||||
<li>Events: <br>
|
||||
<a href="../advanced_init/events_live.html">Live events</a> /
|
||||
<a href="../advanced_init/events_pre_init.html">Pre-init</a> /
|
||||
<a href="../advanced_init/events_post_init.html">Post-init</a>
|
||||
</li>
|
||||
<li><a href="../advanced_init/column_render.html">Column rendering</a></li>
|
||||
<li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
|
||||
<li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
|
||||
<li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
|
||||
<li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
|
||||
<li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
|
||||
<li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
|
||||
<li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
|
||||
<li><a href="../advanced_init/row_callback.html">Row callback</a></li>
|
||||
<li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
|
||||
<li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
|
||||
<li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
|
||||
<li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
|
||||
<li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
|
||||
<li><a href="../advanced_init/dt_events.html">Custom events</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>API</h2>
|
||||
<ul>
|
||||
<li><a href="../api/add_row.html">Dynamically add a new row</a></li>
|
||||
<li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
|
||||
<li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
|
||||
<li><a href="../api/highlight.html">Highlight rows and columns</a></li>
|
||||
<li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
|
||||
<li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
|
||||
<li><a href="../api/form.html">Submit form with elements in table</a></li>
|
||||
<li><a href="../api/counter_column.html">Index column (static number column)</a></li>
|
||||
<li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
|
||||
<li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
|
||||
<li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
|
||||
<li><a href="../api/regex.html">Regular expression filtering</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="demo_links">
|
||||
<h2>Data sources</h2>
|
||||
<ul>
|
||||
<li><a href="../data_sources/dom.html">DOM</a></li>
|
||||
<li><a href="../data_sources/js_array.html">Javascript array</a></li>
|
||||
<li><a href="../data_sources/ajax.html">Ajax source</a></li>
|
||||
<li><a href="../data_sources/server_side.html">Server side processing</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Server-side processing</h2>
|
||||
<ul>
|
||||
<li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
|
||||
<li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
|
||||
<li><a href="../server_side/post.html">Use HTTP POST</a></li>
|
||||
<li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
|
||||
<li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
|
||||
<li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
|
||||
<li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
|
||||
<li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
|
||||
<li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Ajax data source</h2>
|
||||
<ul>
|
||||
<li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
|
||||
<li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
|
||||
<li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
|
||||
<li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
|
||||
<li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
|
||||
<li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
|
||||
<li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Plug-ins</h2>
|
||||
<ul>
|
||||
<li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
|
||||
<li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
|
||||
<li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
|
||||
<li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
|
||||
<li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer" class="clear" style="text-align:center;">
|
||||
<p>
|
||||
Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<span style="font-size:10px;">
|
||||
DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
|
||||
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>.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,403 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
|
||||
|
||||
<title>DataTables example</title>
|
||||
<style type="text/css" title="currentStyle">
|
||||
@import "../../media/css/demo_page.css";
|
||||
@import "../../media/css/demo_table.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/server_processing.php"
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body id="dt_example">
|
||||
<div id="container">
|
||||
<div class="full_width big">
|
||||
DataTables server-side processing example
|
||||
</div>
|
||||
|
||||
<h1>Preamble</h1>
|
||||
<p>There are many ways to get your data into DataTables, and if you are working with seriously large databases, you might want to consider using the server-side options that DataTables provides. Basically all of the paging, filtering, sorting etc that DataTables does can be handed off to a server (or any other data source - Google Gears or Adobe Air for example!) and DataTables is just an events and display module.</p>
|
||||
<p>The example here shows a very simple display of the CSS data (used in all my other examples), but in this instance coming from the server on each draw. Filtering, multi-column sorting etc all work as you would expect.</p>
|
||||
|
||||
<h1>Live example</h1>
|
||||
<div id="dynamic">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">Rendering engine</th>
|
||||
<th width="25%">Browser</th>
|
||||
<th width="25%">Platform(s)</th>
|
||||
<th width="15%">Engine version</th>
|
||||
<th width="15%">CSS grade</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="5" class="dataTables_empty">Loading data from server</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Rendering engine</th>
|
||||
<th>Browser</th>
|
||||
<th>Platform(s)</th>
|
||||
<th>Engine version</th>
|
||||
<th>CSS grade</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
|
||||
|
||||
<h1>Initialisation code</h1>
|
||||
<pre class="brush: js;">$(document).ready(function() {
|
||||
$('#example').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "scripts/server_processing.php"
|
||||
} );
|
||||
} );</pre>
|
||||
<style type="text/css">
|
||||
@import "../examples_support/syntax/css/shCore.css";
|
||||
</style>
|
||||
<script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
|
||||
|
||||
<h1>Server response</h1>
|
||||
<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>
|
||||
<pre id="latest_xhr" class="brush: js;"></pre>
|
||||
|
||||
<h1>Server side (PHP) code</h1>
|
||||
<pre><?php
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Easy set variables
|
||||
*/
|
||||
|
||||
/* Array of database columns which should be read and sent back to DataTables. Use a space where
|
||||
* you want to insert a non-database field (for example a counter or static image)
|
||||
*/
|
||||
$aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );
|
||||
|
||||
/* Indexed column (used for fast and accurate table cardinality) */
|
||||
$sIndexColumn = "id";
|
||||
|
||||
/* DB table to use */
|
||||
$sTable = "ajax";
|
||||
|
||||
/* Database connection information */
|
||||
$gaSql['user'] = "";
|
||||
$gaSql['password'] = "";
|
||||
$gaSql['db'] = "";
|
||||
$gaSql['server'] = "localhost";
|
||||
|
||||
/* REMOVE THIS LINE (it just includes my SQL connection user/pass) */
|
||||
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" );
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Paging
|
||||
*/
|
||||
$sLimit = "";
|
||||
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
||||
{
|
||||
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
|
||||
intval( $_GET['iDisplayLength'] );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ordering
|
||||
*/
|
||||
$sOrder = "";
|
||||
if ( isset( $_GET['iSortCol_0'] ) )
|
||||
{
|
||||
$sOrder = "ORDER BY ";
|
||||
for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
|
||||
{
|
||||
if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
|
||||
{
|
||||
$sOrder .= "`".$aColumns[ intval( $_GET['iSortCol_'.$i] ) ]."` ".
|
||||
($_GET['sSortDir_'.$i]==='asc' ? 'asc' : 'desc') .", ";
|
||||
}
|
||||
}
|
||||
|
||||
$sOrder = substr_replace( $sOrder, "", -2 );
|
||||
if ( $sOrder == "ORDER BY" )
|
||||
{
|
||||
$sOrder = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Filtering
|
||||
* NOTE this does not match the built-in DataTables filtering which does it
|
||||
* word by word on any field. It's possible to do here, but concerned about efficiency
|
||||
* on very large tables, and MySQL's regex functionality is very limited
|
||||
*/
|
||||
$sWhere = "";
|
||||
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
|
||||
{
|
||||
$sWhere = "WHERE (";
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
$sWhere .= "`".$aColumns[$i]."` LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ";
|
||||
}
|
||||
$sWhere = substr_replace( $sWhere, "", -3 );
|
||||
$sWhere .= ')';
|
||||
}
|
||||
|
||||
/* Individual column filtering */
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' )
|
||||
{
|
||||
if ( $sWhere == "" )
|
||||
{
|
||||
$sWhere = "WHERE ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sWhere .= " AND ";
|
||||
}
|
||||
$sWhere .= "`".$aColumns[$i]."` LIKE '%".mysql_real_escape_string($_GET['sSearch_'.$i])."%' ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SQL queries
|
||||
* Get data to display
|
||||
*/
|
||||
$sQuery = "
|
||||
SELECT SQL_CALC_FOUND_ROWS `".str_replace(" , ", " ", implode("`, `", $aColumns))."`
|
||||
FROM $sTable
|
||||
$sWhere
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
/* Total data set length */
|
||||
$sQuery = "
|
||||
SELECT COUNT(`".$sIndexColumn."`)
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
||||
/*
|
||||
* Output
|
||||
*/
|
||||
$output = array(
|
||||
"sEcho" => intval($_GET['sEcho']),
|
||||
"iTotalRecords" => $iTotal,
|
||||
"iTotalDisplayRecords" => $iFilteredTotal,
|
||||
"aaData" => array()
|
||||
);
|
||||
|
||||
while ( $aRow = mysql_fetch_array( $rResult ) )
|
||||
{
|
||||
$row = array();
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( $aColumns[$i] == "version" )
|
||||
{
|
||||
/* Special output formatting for 'version' column */
|
||||
$row[] = ($aRow[ $aColumns[$i] ]=="0") ? '-' : $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
else if ( $aColumns[$i] != ' ' )
|
||||
{
|
||||
/* General output */
|
||||
$row[] = $aRow[ $aColumns[$i] ];
|
||||
}
|
||||
}
|
||||
$output['aaData'][] = $row;
|
||||
}
|
||||
|
||||
echo json_encode( $output );
|
||||
?></pre>
|
||||
|
||||
|
||||
<h1>Other examples</h1>
|
||||
<div class="demo_links">
|
||||
<h2>Basic initialisation</h2>
|
||||
<ul>
|
||||
<li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
|
||||
<li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
|
||||
<li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
|
||||
<li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
|
||||
<li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
|
||||
<li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
|
||||
<li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
|
||||
<li><a href="../basic_init/dom.html">DOM positioning</a></li>
|
||||
<li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
|
||||
<li><a href="../basic_init/state_save.html">State saving</a></li>
|
||||
<li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
|
||||
<li>Scrolling: <br>
|
||||
<a href="../basic_init/scroll_x.html">Horizontal</a> /
|
||||
<a href="../basic_init/scroll_y.html">Vertical</a> /
|
||||
<a href="../basic_init/scroll_xy.html">Both</a> /
|
||||
<a href="../basic_init/scroll_y_theme.html">Themed</a> /
|
||||
<a href="../basic_init/scroll_y_infinite.html">Infinite</a>
|
||||
</li>
|
||||
<li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
|
||||
<li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Advanced initialisation</h2>
|
||||
<ul>
|
||||
<li>Events: <br>
|
||||
<a href="../advanced_init/events_live.html">Live events</a> /
|
||||
<a href="../advanced_init/events_pre_init.html">Pre-init</a> /
|
||||
<a href="../advanced_init/events_post_init.html">Post-init</a>
|
||||
</li>
|
||||
<li><a href="../advanced_init/column_render.html">Column rendering</a></li>
|
||||
<li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
|
||||
<li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
|
||||
<li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
|
||||
<li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
|
||||
<li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
|
||||
<li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
|
||||
<li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
|
||||
<li><a href="../advanced_init/row_callback.html">Row callback</a></li>
|
||||
<li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
|
||||
<li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
|
||||
<li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
|
||||
<li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
|
||||
<li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
|
||||
<li><a href="../advanced_init/dt_events.html">Custom events</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>API</h2>
|
||||
<ul>
|
||||
<li><a href="../api/add_row.html">Dynamically add a new row</a></li>
|
||||
<li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
|
||||
<li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
|
||||
<li><a href="../api/highlight.html">Highlight rows and columns</a></li>
|
||||
<li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
|
||||
<li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
|
||||
<li><a href="../api/form.html">Submit form with elements in table</a></li>
|
||||
<li><a href="../api/counter_column.html">Index column (static number column)</a></li>
|
||||
<li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
|
||||
<li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
|
||||
<li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
|
||||
<li><a href="../api/regex.html">Regular expression filtering</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="demo_links">
|
||||
<h2>Data sources</h2>
|
||||
<ul>
|
||||
<li><a href="../data_sources/dom.html">DOM</a></li>
|
||||
<li><a href="../data_sources/js_array.html">Javascript array</a></li>
|
||||
<li><a href="../data_sources/ajax.html">Ajax source</a></li>
|
||||
<li><a href="../data_sources/server_side.html">Server side processing</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Server-side processing</h2>
|
||||
<ul>
|
||||
<li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
|
||||
<li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
|
||||
<li><a href="../server_side/post.html">Use HTTP POST</a></li>
|
||||
<li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
|
||||
<li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
|
||||
<li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
|
||||
<li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
|
||||
<li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
|
||||
<li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
|
||||
<li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
|
||||
<li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Ajax data source</h2>
|
||||
<ul>
|
||||
<li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
|
||||
<li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
|
||||
<li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
|
||||
<li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
|
||||
<li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
|
||||
<li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
|
||||
<li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Plug-ins</h2>
|
||||
<ul>
|
||||
<li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
|
||||
<li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
|
||||
<li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
|
||||
<li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
|
||||
<li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
|
||||
<li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer" class="clear" style="text-align:center;">
|
||||
<p>
|
||||
Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<span style="font-size:10px;">
|
||||
DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
|
||||
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>.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user