mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-18 11:52:11 +01:00
Fixed: fnInitComplete was being called too early for server-side processing. It is now called after the first draw is complete, like the other data sources.
This commit is contained in:
parent
4154332be2
commit
2c4def9353
14
media/js/jquery.dataTables.js
vendored
14
media/js/jquery.dataTables.js
vendored
@ -2262,7 +2262,7 @@
|
||||
|
||||
_fnProcessingDisplay( oSettings, false );
|
||||
|
||||
/* Run the init callback if there is one */
|
||||
/* Run the init callback if there is one - done here for ajax source for json obj */
|
||||
if ( typeof oSettings.fnInitComplete == 'function' )
|
||||
{
|
||||
oSettings.fnInitComplete.call( oSettings.oInstance, oSettings, json );
|
||||
@ -2271,12 +2271,6 @@
|
||||
return;
|
||||
}
|
||||
|
||||
/* Run the init callback if there is one */
|
||||
if ( typeof oSettings.fnInitComplete == 'function' )
|
||||
{
|
||||
oSettings.fnInitComplete.call( oSettings.oInstance, oSettings );
|
||||
}
|
||||
|
||||
if ( !oSettings.oFeatures.bServerSide )
|
||||
{
|
||||
_fnProcessingDisplay( oSettings, false );
|
||||
@ -3041,6 +3035,12 @@
|
||||
_fnAjustColumnSizing( oSettings );
|
||||
}
|
||||
|
||||
if ( typeof oSettings.fnInitComplete == 'function' &&
|
||||
(oSettings.oFeatures.bServerSide || oSettings.sAjaxSource === null) )
|
||||
{
|
||||
oSettings.fnInitComplete.call( oSettings.oInstance, oSettings );
|
||||
}
|
||||
|
||||
/* Set an absolute width for the table such that pagination doesn't
|
||||
* cause the table to resize - disabled for now.
|
||||
*/
|
||||
|
@ -73,6 +73,22 @@ $(document).ready( function () {
|
||||
);
|
||||
|
||||
|
||||
oTest.fnWaitTest(
|
||||
"10 rows in the table on complete",
|
||||
function () {
|
||||
oSession.fnRestore();
|
||||
|
||||
mPass = 0;
|
||||
$('#example').dataTable( {
|
||||
"fnInitComplete": function ( ) {
|
||||
mPass = $('#example tbody tr').length;
|
||||
}
|
||||
} );
|
||||
},
|
||||
function () { return mPass == 10; }
|
||||
);
|
||||
|
||||
|
||||
|
||||
oTest.fnComplete();
|
||||
} );
|
@ -19,7 +19,7 @@ $(document).ready( function () {
|
||||
|
||||
|
||||
oTest.fnWaitTest(
|
||||
"One argument passed (for Ajax!)",
|
||||
"Two arguments passed (for Ajax!)",
|
||||
function () {
|
||||
oSession.fnRestore();
|
||||
|
||||
@ -78,6 +78,23 @@ $(document).ready( function () {
|
||||
);
|
||||
|
||||
|
||||
oTest.fnWaitTest(
|
||||
"10 rows in the table on complete",
|
||||
function () {
|
||||
oSession.fnRestore();
|
||||
|
||||
mPass = 0;
|
||||
$('#example').dataTable( {
|
||||
"sAjaxSource": "../../../examples/examples_support/json_source.txt",
|
||||
"fnInitComplete": function ( ) {
|
||||
mPass = $('#example tbody tr').length;
|
||||
}
|
||||
} );
|
||||
},
|
||||
function () { return mPass == 10; }
|
||||
);
|
||||
|
||||
|
||||
|
||||
oTest.fnComplete();
|
||||
} );
|
@ -62,7 +62,7 @@ $(document).ready( function () {
|
||||
mPass = 0;
|
||||
$('#example').dataTable( {
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "../../../examples/examples_support/server_processing.php",
|
||||
"sAjaxSource": "../../../examples/examples_support/server_processing.php",
|
||||
"fnInitComplete": function ( ) {
|
||||
mPass++;
|
||||
}
|
||||
@ -82,6 +82,24 @@ $(document).ready( function () {
|
||||
);
|
||||
|
||||
|
||||
oTest.fnWaitTest(
|
||||
"10 rows in the table on complete",
|
||||
function () {
|
||||
oSession.fnRestore();
|
||||
|
||||
mPass = 0;
|
||||
$('#example').dataTable( {
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "../../../examples/examples_support/server_processing.php",
|
||||
"fnInitComplete": function ( ) {
|
||||
mPass = $('#example tbody tr').length;
|
||||
}
|
||||
} );
|
||||
},
|
||||
function () { return mPass == 10; }
|
||||
);
|
||||
|
||||
|
||||
|
||||
oTest.fnComplete();
|
||||
} );
|
Loading…
x
Reference in New Issue
Block a user