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

Fixed: The second parameter for fnServerData was being passed as null when used without server-side processing. It makes much more sense to pass an empty array - 2553

This commit is contained in:
Allan Jardine 2010-08-20 18:07:34 +01:00
parent d5cb811698
commit 25148e4fec

View File

@ -0,0 +1,64 @@
// 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/examples_support/json_source.txt",
"fnServerData": function () {
mPass = arguments.length;
}
} );
},
function () { return mPass == 3; }
);
oTest.fnTest(
"Url",
function () {
$('#example').dataTable( {
"bDestroy": true,
"sAjaxSource": "../../../examples/examples_support/json_source.txt",
"fnServerData": function (sUrl, aoData, fnCallback) {
mPass = sUrl == "../../../examples/examples_support/json_source.txt";
}
} );
},
function () { return mPass; }
);
oTest.fnTest(
"Data array",
function () {
$('#example').dataTable( {
"bDestroy": true,
"sAjaxSource": "../../../examples/examples_support/json_source.txt",
"fnServerData": function (sUrl, aoData, fnCallback) {
mPass = aoData.length==0;
}
} );
},
function () { return mPass; }
);
oTest.fnTest(
"Callback function",
function () {
$('#example').dataTable( {
"bDestroy": true,
"sAjaxSource": "../../../examples/examples_support/json_source.txt",
"fnServerData": function (sUrl, aoData, fnCallback) {
mPass = typeof fnCallback == 'function';
}
} );
},
function () { return mPass; }
);
oTest.fnComplete();
} );