1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-03-15 16:29:16 +01:00

Fixed: When state saving, it was possible to have a situation where by a table would contain 'n' columns, the user would sort on the last column and then the html is modifed to only have 'n-1' columns. This resulted in a JS error when DataTables tried to restore sorting on the removed column. Now do a sanity check to ensure the sorting column is present, and if not add sorting on column 0.

This commit is contained in:
Allan Jardine 2010-10-30 06:54:10 +01:00
parent dbb51ab117
commit 2bb96f89b0

View File

@ -6727,6 +6727,10 @@
*/ */
for ( i=0, iLen=oSettings.aaSorting.length ; i<iLen ; i++ ) for ( i=0, iLen=oSettings.aaSorting.length ; i<iLen ; i++ )
{ {
if ( oSettings.aaSorting[i][0] >= oSettings.aoColumns.length )
{
oSettings.aaSorting[i][0] = 0;
}
var oColumn = oSettings.aoColumns[ oSettings.aaSorting[i][0] ]; var oColumn = oSettings.aoColumns[ oSettings.aaSorting[i][0] ];
/* Add a default sorting index */ /* Add a default sorting index */