From 5a0c1f5ac6e3d266705f5aff4eb9678a10d3bcd0 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Wed, 27 Mar 2013 09:25:55 +0000 Subject: [PATCH] Fix #168 - fnInitComplete should give json as second parameter as well - When server-side processing is enabled, fnInitComplete will now be passed a second parameter, the json returned from the server for that first draw, matching the Ajax data source with client-side processing option. --- media/js/jquery.dataTables.js | 17 +++++++---------- media/src/core/core.ajax.js | 6 ++++++ media/src/core/core.draw.js | 9 --------- media/src/core/core.init.js | 2 +- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index d4e62fc2..3ee6ed3b 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -1575,15 +1575,6 @@ oSettings.bSorted = false; oSettings.bFiltered = false; oSettings.bDrawing = false; - - if ( oSettings.oFeatures.bServerSide ) - { - _fnProcessingDisplay( oSettings, false ); - if ( !oSettings._bInitComplete ) - { - _fnInitComplete( oSettings ); - } - } } @@ -2121,6 +2112,12 @@ oSettings.bAjaxDataGet = false; _fnDraw( oSettings ); + + if ( ! oSettings._bInitComplete ) + { + _fnInitComplete( oSettings, json ); + } + oSettings.bAjaxDataGet = true; _fnProcessingDisplay( oSettings, false ); } @@ -2759,7 +2756,7 @@ return; } - /* Server-side processing initialisation complete is done at the end of _fnDraw */ + /* Server-side processing init complete is done by _fnAjaxUpdateDraw */ if ( !oSettings.oFeatures.bServerSide ) { _fnProcessingDisplay( oSettings, false ); diff --git a/media/src/core/core.ajax.js b/media/src/core/core.ajax.js index d5bdfcbf..321cb602 100644 --- a/media/src/core/core.ajax.js +++ b/media/src/core/core.ajax.js @@ -237,6 +237,12 @@ function _fnAjaxUpdateDraw ( oSettings, json ) oSettings.bAjaxDataGet = false; _fnDraw( oSettings ); + + if ( ! oSettings._bInitComplete ) + { + _fnInitComplete( oSettings, json ); + } + oSettings.bAjaxDataGet = true; _fnProcessingDisplay( oSettings, false ); } diff --git a/media/src/core/core.draw.js b/media/src/core/core.draw.js index cf63eb6f..71c80833 100644 --- a/media/src/core/core.draw.js +++ b/media/src/core/core.draw.js @@ -490,15 +490,6 @@ function _fnDraw( oSettings ) oSettings.bSorted = false; oSettings.bFiltered = false; oSettings.bDrawing = false; - - if ( oSettings.oFeatures.bServerSide ) - { - _fnProcessingDisplay( oSettings, false ); - if ( !oSettings._bInitComplete ) - { - _fnInitComplete( oSettings ); - } - } } diff --git a/media/src/core/core.init.js b/media/src/core/core.init.js index ce251c30..8038e468 100644 --- a/media/src/core/core.init.js +++ b/media/src/core/core.init.js @@ -98,7 +98,7 @@ function _fnInitialise ( oSettings ) return; } - /* Server-side processing initialisation complete is done at the end of _fnDraw */ + /* Server-side processing init complete is done by _fnAjaxUpdateDraw */ if ( !oSettings.oFeatures.bServerSide ) { _fnProcessingDisplay( oSettings, false );