Permalink
Browse files

Examples: Updating examples for the new `ajax` property

- Note that this update is not complete, just the initialisation is
  done. The examples will shortly be rewritten to be more modular when
  this will be completed (i.e. the code shown on the page will be
  updated)
  • Loading branch information...
1 parent 39ad1e7 commit 83b96242737694263e98ec98e7c0fbe6a24a7287 @DataTables committed Feb 10, 2013
View
4 examples/ajax/ajax.html
@@ -14,8 +14,8 @@
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var oTable = $('#example').dataTable( {
- "bProcessing": true,
- "sAjaxSource": "sources/arrays.txt"
+ "processing": true,
+ "ajax": "sources/arrays.txt"
} );
} );
</script>
View
8 examples/ajax/custom_data_property.html
@@ -14,9 +14,11 @@
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var oTable = $('#example').dataTable( {
- "bProcessing": true,
- "sAjaxSource": "sources/custom_prop.txt",
- "sAjaxDataProp": "demo"
+ "processing": true,
+ "ajax": {
+ "url": "sources/custom_prop.txt",
+ "dataSrc": "demo"
+ }
} );
} );
</script>
View
16 examples/ajax/deep.html
@@ -14,14 +14,14 @@
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var oTable = $('#example').dataTable( {
- "bProcessing": true,
- "sAjaxSource": "sources/deep.txt",
- "aoColumns": [
- { "mData": "engine" },
- { "mData": "browser" },
- { "mData": "platform.inner" },
- { "mData": "platform.details.0" },
- { "mData": "platform.details.1" }
+ "processing": true,
+ "ajax": "sources/deep.txt",
+ "columns": [
+ { "data": "engine" },
+ { "data": "browser" },
+ { "data": "platform.inner" },
+ { "data": "platform.details.0" },
+ { "data": "platform.details.1" }
]
} );
} );
View
8 examples/ajax/defer_render.html
@@ -13,10 +13,10 @@
<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,
- "sAjaxSource": "sources/arrays.txt",
- "bDeferRender": true
+ $('#example').dataTable( {
+ "processing": true,
+ "ajax": "sources/arrays.txt",
+ "deferRender": true
} );
} );
</script>
View
8 examples/ajax/null_data_source.html
@@ -14,15 +14,15 @@
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var oTable = $('#example').dataTable( {
- "bProcessing": true,
- "sAjaxSource": "sources/arrays.txt",
- "aoColumns": [
+ "processing": true,
+ "ajax": "sources/arrays.txt",
+ "columns": [
null,
null,
null,
null,
null,
- { "mData": null }
+ { "data": null }
]
} );
} );
View
16 examples/ajax/objects.html
@@ -14,14 +14,14 @@
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var oTable = $('#example').dataTable( {
- "bProcessing": true,
- "sAjaxSource": "sources/objects.txt",
- "aoColumns": [
- { "mData": "engine" },
- { "mData": "browser" },
- { "mData": "platform" },
- { "mData": "version" },
- { "mData": "grade" }
+ "processing": true,
+ "ajax": "sources/objects.txt",
+ "columns": [
+ { "data": "engine" },
+ { "data": "browser" },
+ { "data": "platform" },
+ { "data": "version" },
+ { "data": "grade" }
]
} );
} );
View
16 examples/ajax/objects_subarrays.html
@@ -14,14 +14,14 @@
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var oTable = $('#example').dataTable( {
- "bProcessing": true,
- "sAjaxSource": "sources/objects_subarrays.txt",
- "aoColumns": [
- { "mData": "engine" },
- { "mData": "browser" },
- { "mData": "platform" },
- { "mData": "details.0" },
- { "mData": "details.1" }
+ "processing": true,
+ "ajax": "sources/objects_subarrays.txt",
+ "columns": [
+ { "data": "engine" },
+ { "data": "browser" },
+ { "data": "platform" },
+ { "data": "details.0" },
+ { "data": "details.1" }
]
} );
} );
View
12 examples/server_side/custom_vars.html
@@ -14,11 +14,13 @@
<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" } );
+ "processing": true,
+ "serverSide": true,
+ "ajax": {
+ "url": "scripts/server_processing.php",
+ "data": [
+ { "name": "more_data", "value": "my_value" }
+ ]
}
} );
} );
View
8 examples/server_side/defer_loading.html
@@ -14,10 +14,10 @@
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable( {
- "bProcessing": true,
- "bServerSide": true,
- "sAjaxSource": "scripts/server_processing.php",
- "iDeferLoading": 57
+ "processing": true,
+ "serverSide": true,
+ "ajax": "scripts/server_processing.php",
+ "deferLoading": 57
} );
} );
</script>
View
8 examples/server_side/editable.html
@@ -15,10 +15,10 @@
<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 () {
+ "processing": true,
+ "serverSide": true,
+ "ajax": "scripts/server_processing.php",
+ "drawCallback": function () {
$('#example tbody td').editable( '../examples_support/editable_ajax.php', {
"callback": function( sValue, y ) {
/* Redraw the table from the new data on the server */
View
6 examples/server_side/ids.html
@@ -14,9 +14,9 @@
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable( {
- "bProcessing": true,
- "bServerSide": true,
- "sAjaxSource": "scripts/id.php"
+ "processing": true,
+ "serverSide": true,
+ "ajax": "scripts/id.php"
} );
} );
</script>
View
16 examples/server_side/jsonp.html
@@ -14,17 +14,11 @@
<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
- } );
+ "processing": true,
+ "serverSide": true,
+ "ajax": {
+ "url": "scripts/jsonp.php",
+ "dataType": "jsonp"
}
} );
} );
View
18 examples/server_side/object_data.html
@@ -14,15 +14,15 @@
<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" }
+ "processing": true,
+ "serverSide": true,
+ "ajax": "scripts/objects.php",
+ "columns": [
+ { "data": "engine" },
+ { "data": "browser" },
+ { "data": "platform" },
+ { "data": "version" },
+ { "data": "grade" }
]
} );
} );
View
10 examples/server_side/pipeline.html
@@ -39,9 +39,10 @@
return null;
}
- function fnDataTablesPipeline ( sSource, aoData, fnCallback, oSettings ) {
+ function fnDataTablesPipeline ( aoData, fnCallback, oSettings ) {
var iPipe = 5; /* Ajust the pipe size */
+ var sSource = "scripts/server_processing.php";
var bNeedServer = false;
var sEcho = fnGetKey(aoData, "sEcho");
var iRequestStart = fnGetKey(aoData, "iDisplayStart");
@@ -117,10 +118,9 @@
$(document).ready(function() {
$('#example').dataTable( {
- "bProcessing": true,
- "bServerSide": true,
- "sAjaxSource": "scripts/server_processing.php",
- "fnServerData": fnDataTablesPipeline
+ "processing": true,
+ "serverSide": true,
+ "ajax": fnDataTablesPipeline
} );
} );
</script>
View
10 examples/server_side/post.html
@@ -14,10 +14,12 @@
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable( {
- "bProcessing": true,
- "bServerSide": true,
- "sAjaxSource": "scripts/post.php",
- "sServerMethod": "POST"
+ "processing": true,
+ "serverSide": true,
+ "ajax": {
+ "url": "scripts/post.php",
+ "type": "POST"
+ }
} );
} );
</script>
View
16 examples/server_side/row_details.html
@@ -29,18 +29,18 @@
$(document).ready(function() {
oTable = $('#example').dataTable( {
- "bProcessing": true,
- "bServerSide": true,
- "sAjaxSource": "scripts/details_col.php",
- "aoColumns": [
- { "sClass": "center", "bSortable": false },
+ "processing": true,
+ "serverSide": true,
+ "ajax": "scripts/details_col.php",
+ "columns": [
+ { "class": "center", "sortable": false },
null,
null,
null,
- { "sClass": "center" },
- { "sClass": "center" }
+ { "class": "center" },
+ { "class": "center" }
],
- "aaSorting": [[1, 'asc']]
+ "sorting": [[1, 'asc']]
} );
$('#example tbody td img').live( 'click', function () {
View
8 examples/server_side/select_rows.html
@@ -17,10 +17,10 @@
/* Init the table */
$("#example").dataTable({
- "bProcessing": true,
- "bServerSide": true,
- "sAjaxSource": "scripts/id.php",
- "fnRowCallback": function( nRow, aData, iDisplayIndex ) {
+ "processing": true,
+ "serverSide": true,
+ "ajax": "scripts/id.php",
+ "rowCallback": function( nRow, aData, iDisplayIndex ) {
if ( jQuery.inArray(aData.DT_RowId, aSelected) !== -1 ) {
$(nRow).addClass('row_selected');
}
View
6 examples/server_side/server_side.html
@@ -14,9 +14,9 @@
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable( {
- "bProcessing": true,
- "bServerSide": true,
- "sAjaxSource": "scripts/server_processing.php"
+ "processing": true,
+ "serverSide": true,
+ "ajax": "scripts/server_processing.php"
} );
} );
</script>

0 comments on commit 83b9624

Please sign in to comment.