1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 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(); } ); |