From 01ffda313f26a5ddaa15b6a4d90b03d35b891c98 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Sun, 6 Mar 2011 14:54:54 +0000 Subject: [PATCH] New: Defered loading feature for server-side processing. With this feature enabled (controlled by the new initialisation parameter iDeferLoading) DataTables will not make a request to the server for the first page draw - rather it will use the data already on the page (no sorting etc will be applied to it). iDeferLoading is used to indicate that defered loading is required, but it is also used to tell DataTables how many records there are in the full table (allowing the information element and pagination to be displayed correctly). The intention of this feature is to improve the progressive enhancement foundation and accessibility of DataTables. --- media/js/jquery.dataTables.js | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index a1d6d33b..a5b5769d 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -1159,6 +1159,14 @@ */ this.nTableWrapper = null; + /* + * Variable: bDeferLoading + * Purpose: Indicate if when using server-side processing the loading of data + * should be defered until the second draw + * Scope: jQuery.dataTable.classSettings + */ + this.bDeferLoading = false; + /* * Variable: bInitialised * Purpose: Indicate if all required information has been read in @@ -2711,7 +2719,7 @@ * Add the data object for the whole table - storing the tr node. Note - no point in getting * DOM based data if we are going to go and replace it with Ajax source data. */ - if ( oSettings.sAjaxSource === null ) + if ( oSettings.bDeferLoading || oSettings.sAjaxSource === null ) { nTrs = oSettings.nTBody.childNodes; for ( i=0, iLen=nTrs.length ; i