mirror of
https://github.com/DataTables/DataTables.git
synced 2024-12-01 13:24:10 +01:00
e08f95f5a2
New: sLoadingRecords tests added for Ajax source loading
64 lines
1.4 KiB
JavaScript
64 lines
1.4 KiB
JavaScript
// DATA_TEMPLATE: empty_table
|
|
oTest.fnStart( "fnServerData for Ajax sourced data" );
|
|
|
|
$(document).ready( function () {
|
|
var mPass;
|
|
|
|
oTest.fnTest(
|
|
"Argument length",
|
|
function () {
|
|
$('#example').dataTable( {
|
|
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
|
|
"fnServerData": function () {
|
|
mPass = arguments.length;
|
|
}
|
|
} );
|
|
},
|
|
function () { return mPass == 4; }
|
|
);
|
|
|
|
oTest.fnTest(
|
|
"Url",
|
|
function () {
|
|
$('#example').dataTable( {
|
|
"bDestroy": true,
|
|
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
|
|
"fnServerData": function (sUrl, aoData, fnCallback, oSettings) {
|
|
mPass = sUrl == "../../../examples/ajax/sources/arrays.txt";
|
|
}
|
|
} );
|
|
},
|
|
function () { return mPass; }
|
|
);
|
|
|
|
oTest.fnTest(
|
|
"Data array",
|
|
function () {
|
|
$('#example').dataTable( {
|
|
"bDestroy": true,
|
|
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
|
|
"fnServerData": function (sUrl, aoData, fnCallback, oSettings) {
|
|
mPass = aoData.length==0;
|
|
}
|
|
} );
|
|
},
|
|
function () { return mPass; }
|
|
);
|
|
|
|
oTest.fnTest(
|
|
"Callback function",
|
|
function () {
|
|
$('#example').dataTable( {
|
|
"bDestroy": true,
|
|
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
|
|
"fnServerData": function (sUrl, aoData, fnCallback, oSettings) {
|
|
mPass = typeof fnCallback == 'function';
|
|
}
|
|
} );
|
|
},
|
|
function () { return mPass; }
|
|
);
|
|
|
|
|
|
oTest.fnComplete();
|
|
} ); |