From f817e9a0be9a28e7804ee618ff59957c9f627156 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Tue, 6 Aug 2013 09:08:10 +0100 Subject: [PATCH] Dev fix: State saving was breaking on sort - My fix a while back for detecting if a column was no longer available in a table was duff, since it used $.map which flattens its array return, but sorting needs a 2D array. - Fixed by doing our own itteration --- .datatables-commit-sync | 2 +- media/js/jquery.dataTables.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.datatables-commit-sync b/.datatables-commit-sync index 5d3990f7..efa80f22 100644 --- a/.datatables-commit-sync +++ b/.datatables-commit-sync @@ -1 +1 @@ -da2fd7496f9b3af515df83a26c61c05d9451ae42 +06352304626267c445f0816cdf446860af77e721 diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 0117d3f6..be2777ef 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -4319,9 +4319,15 @@ oSettings._iDisplayStart = oData.iStart; oSettings.iInitDisplayStart = oData.iStart; oSettings._iDisplayLength = oData.iLength; - oSettings.aaSorting = $.map( oData.aaSorting, function (d) { - return d[0] >= columns.length ? [ 0, columns[i].asSorting[0] ] : d; - } ); + oSettings.aaSorting = []; + + var savedSort = oData.aaSorting; + for ( i=0, ien=savedSort.length ; i= columns.length ? + [ 0, savedSort[i][1] ] : + savedSort[i] + ); + } /* Search filtering */ $.extend( oSettings.oPreviousSearch, oData.oSearch );