mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-30 23: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:
parent
39ad1e7004
commit
83b9624273
@ -14,8 +14,8 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var oTable = $('#example').dataTable( {
|
var oTable = $('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"sAjaxSource": "sources/arrays.txt"
|
"ajax": "sources/arrays.txt"
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
</script>
|
</script>
|
||||||
|
@ -14,9 +14,11 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var oTable = $('#example').dataTable( {
|
var oTable = $('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"sAjaxSource": "sources/custom_prop.txt",
|
"ajax": {
|
||||||
"sAjaxDataProp": "demo"
|
"url": "sources/custom_prop.txt",
|
||||||
|
"dataSrc": "demo"
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
</script>
|
</script>
|
||||||
|
@ -14,14 +14,14 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var oTable = $('#example').dataTable( {
|
var oTable = $('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"sAjaxSource": "sources/deep.txt",
|
"ajax": "sources/deep.txt",
|
||||||
"aoColumns": [
|
"columns": [
|
||||||
{ "mData": "engine" },
|
{ "data": "engine" },
|
||||||
{ "mData": "browser" },
|
{ "data": "browser" },
|
||||||
{ "mData": "platform.inner" },
|
{ "data": "platform.inner" },
|
||||||
{ "mData": "platform.details.0" },
|
{ "data": "platform.details.0" },
|
||||||
{ "mData": "platform.details.1" }
|
{ "data": "platform.details.1" }
|
||||||
]
|
]
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var oTable = $('#example').dataTable( {
|
$('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"sAjaxSource": "sources/arrays.txt",
|
"ajax": "sources/arrays.txt",
|
||||||
"bDeferRender": true
|
"deferRender": true
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
</script>
|
</script>
|
||||||
|
@ -14,15 +14,15 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var oTable = $('#example').dataTable( {
|
var oTable = $('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"sAjaxSource": "sources/arrays.txt",
|
"ajax": "sources/arrays.txt",
|
||||||
"aoColumns": [
|
"columns": [
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
{ "mData": null }
|
{ "data": null }
|
||||||
]
|
]
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
@ -14,14 +14,14 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var oTable = $('#example').dataTable( {
|
var oTable = $('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"sAjaxSource": "sources/objects.txt",
|
"ajax": "sources/objects.txt",
|
||||||
"aoColumns": [
|
"columns": [
|
||||||
{ "mData": "engine" },
|
{ "data": "engine" },
|
||||||
{ "mData": "browser" },
|
{ "data": "browser" },
|
||||||
{ "mData": "platform" },
|
{ "data": "platform" },
|
||||||
{ "mData": "version" },
|
{ "data": "version" },
|
||||||
{ "mData": "grade" }
|
{ "data": "grade" }
|
||||||
]
|
]
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
@ -14,14 +14,14 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var oTable = $('#example').dataTable( {
|
var oTable = $('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"sAjaxSource": "sources/objects_subarrays.txt",
|
"ajax": "sources/objects_subarrays.txt",
|
||||||
"aoColumns": [
|
"columns": [
|
||||||
{ "mData": "engine" },
|
{ "data": "engine" },
|
||||||
{ "mData": "browser" },
|
{ "data": "browser" },
|
||||||
{ "mData": "platform" },
|
{ "data": "platform" },
|
||||||
{ "mData": "details.0" },
|
{ "data": "details.0" },
|
||||||
{ "mData": "details.1" }
|
{ "data": "details.1" }
|
||||||
]
|
]
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
@ -14,11 +14,13 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#example').dataTable( {
|
$('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"bServerSide": true,
|
"serverSide": true,
|
||||||
"sAjaxSource": "scripts/server_processing.php",
|
"ajax": {
|
||||||
"fnServerParams": function ( aoData ) {
|
"url": "scripts/server_processing.php",
|
||||||
aoData.push( { "name": "more_data", "value": "my_value" } );
|
"data": [
|
||||||
|
{ "name": "more_data", "value": "my_value" }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#example').dataTable( {
|
$('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"bServerSide": true,
|
"serverSide": true,
|
||||||
"sAjaxSource": "scripts/server_processing.php",
|
"ajax": "scripts/server_processing.php",
|
||||||
"iDeferLoading": 57
|
"deferLoading": 57
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
</script>
|
</script>
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var oTable = $('#example').dataTable( {
|
var oTable = $('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"bServerSide": true,
|
"serverSide": true,
|
||||||
"sAjaxSource": "scripts/server_processing.php",
|
"ajax": "scripts/server_processing.php",
|
||||||
"fnDrawCallback": function () {
|
"drawCallback": function () {
|
||||||
$('#example tbody td').editable( '../examples_support/editable_ajax.php', {
|
$('#example tbody td').editable( '../examples_support/editable_ajax.php', {
|
||||||
"callback": function( sValue, y ) {
|
"callback": function( sValue, y ) {
|
||||||
/* Redraw the table from the new data on the server */
|
/* Redraw the table from the new data on the server */
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#example').dataTable( {
|
$('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"bServerSide": true,
|
"serverSide": true,
|
||||||
"sAjaxSource": "scripts/id.php"
|
"ajax": "scripts/id.php"
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
</script>
|
</script>
|
||||||
|
@ -14,17 +14,11 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#example').dataTable( {
|
$('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"bServerSide": true,
|
"serverSide": true,
|
||||||
"sAjaxSource": "scripts/jsonp.php",
|
"ajax": {
|
||||||
"fnServerData": function( sUrl, aoData, fnCallback, oSettings ) {
|
"url": "scripts/jsonp.php",
|
||||||
oSettings.jqXHR = $.ajax( {
|
"dataType": "jsonp"
|
||||||
"url": sUrl,
|
|
||||||
"data": aoData,
|
|
||||||
"success": fnCallback,
|
|
||||||
"dataType": "jsonp",
|
|
||||||
"cache": false
|
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
@ -14,15 +14,15 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#example').dataTable( {
|
$('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"bServerSide": true,
|
"serverSide": true,
|
||||||
"sAjaxSource": "scripts/objects.php",
|
"ajax": "scripts/objects.php",
|
||||||
"aoColumns": [
|
"columns": [
|
||||||
{ "mData": "engine" },
|
{ "data": "engine" },
|
||||||
{ "mData": "browser" },
|
{ "data": "browser" },
|
||||||
{ "mData": "platform" },
|
{ "data": "platform" },
|
||||||
{ "mData": "version" },
|
{ "data": "version" },
|
||||||
{ "mData": "grade" }
|
{ "data": "grade" }
|
||||||
]
|
]
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
@ -39,9 +39,10 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fnDataTablesPipeline ( sSource, aoData, fnCallback, oSettings ) {
|
function fnDataTablesPipeline ( aoData, fnCallback, oSettings ) {
|
||||||
var iPipe = 5; /* Ajust the pipe size */
|
var iPipe = 5; /* Ajust the pipe size */
|
||||||
|
|
||||||
|
var sSource = "scripts/server_processing.php";
|
||||||
var bNeedServer = false;
|
var bNeedServer = false;
|
||||||
var sEcho = fnGetKey(aoData, "sEcho");
|
var sEcho = fnGetKey(aoData, "sEcho");
|
||||||
var iRequestStart = fnGetKey(aoData, "iDisplayStart");
|
var iRequestStart = fnGetKey(aoData, "iDisplayStart");
|
||||||
@ -117,10 +118,9 @@
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#example').dataTable( {
|
$('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"bServerSide": true,
|
"serverSide": true,
|
||||||
"sAjaxSource": "scripts/server_processing.php",
|
"ajax": fnDataTablesPipeline
|
||||||
"fnServerData": fnDataTablesPipeline
|
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
</script>
|
</script>
|
||||||
|
@ -14,10 +14,12 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#example').dataTable( {
|
$('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"bServerSide": true,
|
"serverSide": true,
|
||||||
"sAjaxSource": "scripts/post.php",
|
"ajax": {
|
||||||
"sServerMethod": "POST"
|
"url": "scripts/post.php",
|
||||||
|
"type": "POST"
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
</script>
|
</script>
|
||||||
|
@ -29,18 +29,18 @@
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
oTable = $('#example').dataTable( {
|
oTable = $('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"bServerSide": true,
|
"serverSide": true,
|
||||||
"sAjaxSource": "scripts/details_col.php",
|
"ajax": "scripts/details_col.php",
|
||||||
"aoColumns": [
|
"columns": [
|
||||||
{ "sClass": "center", "bSortable": false },
|
{ "class": "center", "sortable": false },
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
{ "sClass": "center" },
|
{ "class": "center" },
|
||||||
{ "sClass": "center" }
|
{ "class": "center" }
|
||||||
],
|
],
|
||||||
"aaSorting": [[1, 'asc']]
|
"sorting": [[1, 'asc']]
|
||||||
} );
|
} );
|
||||||
|
|
||||||
$('#example tbody td img').live( 'click', function () {
|
$('#example tbody td img').live( 'click', function () {
|
||||||
|
@ -17,10 +17,10 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
/* Init the table */
|
/* Init the table */
|
||||||
$("#example").dataTable({
|
$("#example").dataTable({
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"bServerSide": true,
|
"serverSide": true,
|
||||||
"sAjaxSource": "scripts/id.php",
|
"ajax": "scripts/id.php",
|
||||||
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
|
"rowCallback": function( nRow, aData, iDisplayIndex ) {
|
||||||
if ( jQuery.inArray(aData.DT_RowId, aSelected) !== -1 ) {
|
if ( jQuery.inArray(aData.DT_RowId, aSelected) !== -1 ) {
|
||||||
$(nRow).addClass('row_selected');
|
$(nRow).addClass('row_selected');
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#example').dataTable( {
|
$('#example').dataTable( {
|
||||||
"bProcessing": true,
|
"processing": true,
|
||||||
"bServerSide": true,
|
"serverSide": true,
|
||||||
"sAjaxSource": "scripts/server_processing.php"
|
"ajax": "scripts/server_processing.php"
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user