1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-01-30 23:52:11 +01:00

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
This commit is contained in:
Allan Jardine 2013-08-06 09:08:10 +01:00
parent 6447373eb6
commit f817e9a0be
2 changed files with 10 additions and 4 deletions

View File

@ -1 +1 @@
da2fd7496f9b3af515df83a26c61c05d9451ae42
06352304626267c445f0816cdf446860af77e721

View File

@ -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<ien ; i++ ) {
oSettings.aaSorting.push( savedSort[i][0] >= columns.length ?
[ 0, savedSort[i][1] ] :
savedSort[i]
);
}
/* Search filtering */
$.extend( oSettings.oPreviousSearch, oData.oSearch );