From 473e9b0088a0a4afad5ed3780b0d426dc476b4a3 Mon Sep 17 00:00:00 2001 From: Tim Tucker Date: Sun, 30 Sep 2012 10:21:09 -0300 Subject: [PATCH 1/6] Update media/src/core/core.info.js Only set iStart once and only call fnFormatNumber once on iStart. --- media/src/core/core.info.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/media/src/core/core.info.js b/media/src/core/core.info.js index 1e95b35b..1c0e7d73 100644 --- a/media/src/core/core.info.js +++ b/media/src/core/core.info.js @@ -1,4 +1,3 @@ - /** * Generate the node required for the info display * @param {object} oSettings dataTables settings object @@ -85,8 +84,10 @@ function _fnUpdateInfo ( oSettings ) function _fnInfoMacros ( oSettings, str ) { + // When infinite scrolling, we are always starting at 1. _iDisplayStart is used only + // internally var - iStart = oSettings._iDisplayStart+1, + iStart = oSettings.oScroll.bInfinite ? 1 : oSettings._iDisplayStart+1, sStart = oSettings.fnFormatNumber( iStart ), iEnd = oSettings.fnDisplayEnd(), sEnd = oSettings.fnFormatNumber( iEnd ), @@ -95,13 +96,6 @@ function _fnInfoMacros ( oSettings, str ) iMax = oSettings.fnRecordsTotal(), sMax = oSettings.fnFormatNumber( iMax ); - // When infinite scrolling, we are always starting at 1. _iDisplayStart is used only - // internally - if ( oSettings.oScroll.bInfinite ) - { - sStart = oSettings.fnFormatNumber( 1 ); - } - return str. replace(/_START_/g, sStart). replace(/_END_/g, sEnd). From 7f35d4fb4d1b63f3b58f1266111de46afc2255db Mon Sep 17 00:00:00 2001 From: Tim Tucker Date: Sun, 30 Sep 2012 11:07:24 -0300 Subject: [PATCH 2/6] Update media/src/api/api.static.js Slightly shorter method for checking the version (stops as soon as it reaches a version part that has a difference) --- media/src/api/api.static.js | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/media/src/api/api.static.js b/media/src/api/api.static.js index 5000dce4..18af89d0 100644 --- a/media/src/api/api.static.js +++ b/media/src/api/api.static.js @@ -1,5 +1,4 @@ - /** * Provide a common method for plug-ins to check the version of DataTables being used, in order * to ensure compatibility. @@ -15,25 +14,24 @@ */ DataTable.fnVersionCheck = function( sVersion ) { - /* This is cheap, but effective */ - var fnZPad = function (Zpad, count) - { - while(Zpad.length < count) { - Zpad += '0'; - } - return Zpad; - }; var aThis = DataTable.ext.sVersion.split('.'); var aThat = sVersion.split('.'); - var sThis = '', sThat = ''; + var iThis, sThat; - for ( var i=0, iLen=aThat.length ; i iThat; } - - return parseInt(sThis, 10) >= parseInt(sThat, 10); + return true; }; From 23fc3858d9a31cade61390877985ffa0491e2e96 Mon Sep 17 00:00:00 2001 From: Tim Tucker Date: Sun, 30 Sep 2012 20:05:09 -0300 Subject: [PATCH 3/6] Update media/src/ext/ext.sorting.js handle undefined values, skip toLowerCase call for empty strings --- media/src/ext/ext.sorting.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/media/src/ext/ext.sorting.js b/media/src/ext/ext.sorting.js index 7810a4d5..8c7f8763 100644 --- a/media/src/ext/ext.sorting.js +++ b/media/src/ext/ext.sorting.js @@ -1,12 +1,16 @@ - $.extend( DataTable.ext.oSort, { /* * text sorting */ "string-pre": function ( a ) { - if ( typeof a != 'string' ) { - a = (a !== null && a.toString) ? a.toString() : ''; + if ( typeof a != 'string' ) + { + if (a === null || a === undefined || !a.toString) + { + return ''; + } + a = a.toString(); } return a.toLowerCase(); }, From a3b57061059733dfc8cc7ddbd368c0e95f129b52 Mon Sep 17 00:00:00 2001 From: Tim Tucker Date: Sun, 30 Sep 2012 20:11:36 -0300 Subject: [PATCH 4/6] Update media/src/core/core.ajax.js Remove unnecessary else(s) --- media/src/core/core.ajax.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/media/src/core/core.ajax.js b/media/src/core/core.ajax.js index 11669e09..23f13a59 100644 --- a/media/src/core/core.ajax.js +++ b/media/src/core/core.ajax.js @@ -1,5 +1,4 @@ - /** * Update the table using an Ajax call * @param {object} oSettings dataTables settings object @@ -22,10 +21,7 @@ function _fnAjaxUpdate( oSettings ) }, oSettings ); return false; } - else - { - return true; - } + return true; } @@ -133,10 +129,7 @@ function _fnAjaxUpdateDraw ( oSettings, json ) { return; } - else - { - oSettings.iDraw = json.sEcho * 1; - } + oSettings.iDraw = json.sEcho * 1; } if ( !oSettings.oScroll.bInfinite || From fc445cd3746cc90c7becb28826c7b22f8538554b Mon Sep 17 00:00:00 2001 From: Tim Tucker Date: Tue, 2 Oct 2012 08:55:18 -0300 Subject: [PATCH 5/6] Update media/src/core/core.draw.js Remove check for iOpenRows !== 0, since it isn't really needed. (the contents of the loop just won't execute) --- media/src/core/core.draw.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/media/src/core/core.draw.js b/media/src/core/core.draw.js index 3e5ebe9e..e0ad82be 100644 --- a/media/src/core/core.draw.js +++ b/media/src/core/core.draw.js @@ -380,15 +380,12 @@ function _fnDraw( oSettings ) iRowCount++; /* If there is an open row - and it is attached to this parent - attach it on redraw */ - if ( iOpenRows !== 0 ) + for ( var k=0 ; k Date: Tue, 2 Oct 2012 08:57:42 -0300 Subject: [PATCH 6/6] Update media/src/core/core.draw.js Remove unused variable --- media/src/core/core.draw.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/src/core/core.draw.js b/media/src/core/core.draw.js index 3e5ebe9e..7c711b63 100644 --- a/media/src/core/core.draw.js +++ b/media/src/core/core.draw.js @@ -438,7 +438,7 @@ function _fnDraw( oSettings ) var nAddFrag = document.createDocumentFragment(), nRemoveFrag = document.createDocumentFragment(), - nBodyPar, nTrs; + nBodyPar; if ( oSettings.nTBody ) {