1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-01-18 11:52:11 +01:00

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)
This commit is contained in:
Allan Jardine 2013-02-10 12:26:42 +00:00
parent 39ad1e7004
commit 83b9624273
18 changed files with 97 additions and 97 deletions

View File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -17,10 +17,10 @@ $(document).ready(function() {
/* 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 File

@ -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>