2010-08-17 09:42:13 +02:00
|
|
|
// DATA_TEMPLATE: empty_table
|
|
|
|
oTest.fnStart( "fnInitComplete" );
|
|
|
|
|
|
|
|
/* Fairly boring function compared to the others! */
|
|
|
|
|
|
|
|
$(document).ready( function () {
|
|
|
|
oTest.fnWaitTest(
|
2011-12-14 14:35:49 +01:00
|
|
|
"Two arguments passed",
|
2010-08-17 09:42:13 +02:00
|
|
|
function () {
|
|
|
|
|
|
|
|
mPass = -1;
|
|
|
|
$('#example').dataTable( {
|
|
|
|
"bServerSide": true,
|
2011-04-19 20:35:33 +02:00
|
|
|
"sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
|
2010-08-17 09:42:13 +02:00
|
|
|
"fnInitComplete": function ( ) {
|
2011-12-14 14:35:49 +01:00
|
|
|
mPass = arguments.length===2 && arguments[1]===undefined;
|
2010-08-17 09:42:13 +02:00
|
|
|
}
|
|
|
|
} );
|
|
|
|
},
|
2011-12-14 14:35:49 +01:00
|
|
|
function () { return mPass; }
|
2010-08-17 09:42:13 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
oTest.fnWaitTest(
|
|
|
|
"That one argument is the settings object",
|
|
|
|
function () {
|
|
|
|
oSession.fnRestore();
|
|
|
|
|
|
|
|
oTable = $('#example').dataTable( {
|
|
|
|
"bServerSide": true,
|
2011-04-19 20:35:33 +02:00
|
|
|
"sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
|
2010-08-17 09:42:13 +02:00
|
|
|
"fnInitComplete": function ( oSettings ) {
|
|
|
|
mPass = oSettings;
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
},
|
2012-04-13 19:22:18 +02:00
|
|
|
function () { console.log( oTable.fnSettings(), mPass );return oTable.fnSettings() === mPass; }
|
2010-08-17 09:42:13 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
oTest.fnWaitTest(
|
|
|
|
"fnInitComplete called once on first draw",
|
|
|
|
function () {
|
|
|
|
oSession.fnRestore();
|
|
|
|
|
|
|
|
mPass = 0;
|
|
|
|
$('#example').dataTable( {
|
|
|
|
"bServerSide": true,
|
2011-04-19 20:35:33 +02:00
|
|
|
"sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
|
2010-08-17 09:42:13 +02:00
|
|
|
"fnInitComplete": function ( ) {
|
|
|
|
mPass++;
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
},
|
|
|
|
function () { return mPass == 1; }
|
|
|
|
);
|
|
|
|
|
|
|
|
oTest.fnWaitTest(
|
|
|
|
"fnInitComplete never called there after",
|
|
|
|
function () {
|
|
|
|
$('#example_next').click();
|
|
|
|
$('#example_next').click();
|
|
|
|
$('#example_next').click();
|
|
|
|
},
|
|
|
|
function () { return mPass == 1; }
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2010-09-07 22:37:56 +02:00
|
|
|
oTest.fnWaitTest(
|
|
|
|
"10 rows in the table on complete",
|
|
|
|
function () {
|
|
|
|
oSession.fnRestore();
|
|
|
|
|
|
|
|
mPass = 0;
|
|
|
|
$('#example').dataTable( {
|
|
|
|
"bServerSide": true,
|
2011-04-19 20:35:33 +02:00
|
|
|
"sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
|
2010-09-07 22:37:56 +02:00
|
|
|
"fnInitComplete": function ( ) {
|
|
|
|
mPass = $('#example tbody tr').length;
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
},
|
|
|
|
function () { return mPass == 10; }
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2010-08-17 09:42:13 +02:00
|
|
|
|
|
|
|
oTest.fnComplete();
|
|
|
|
} );
|