From f51f88429d46ae06ffb3936697680985d0c1528b Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Tue, 15 Apr 2014 09:02:55 +0100 Subject: [PATCH] Fix: Column sorting classes might not be applied correctly - If you use multiple column definations such that a columns' sorting options are initially disabled and then enabled, the sorting classes for the header were not being applied correctly. - The fix is to always assign classes based on the most up-to-date information for the column. - This fixes DataTables/DataTables #303 --- .datatables-commit-sync | 2 +- media/js/jquery.dataTables.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.datatables-commit-sync b/.datatables-commit-sync index c83564cc..a26f747e 100644 --- a/.datatables-commit-sync +++ b/.datatables-commit-sync @@ -1 +1 @@ -fd6a64289e82e811d542745a632496ded845f90c +49c27c14b0bd6fee5b1d4e26d9a5ede0f36d4867 diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index dcbb6a08..506aef87 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -516,8 +516,6 @@ var oDefaults = DataTable.defaults.column; var iCol = oSettings.aoColumns.length; var oCol = $.extend( {}, DataTable.models.oColumn, oDefaults, { - "sSortingClass": oSettings.oClasses.sSortable, - "sSortingClassJUI": oSettings.oClasses.sSortJUI, "nTh": nTh ? nTh : document.createElement('th'), "sTitle": oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.innerHTML : '', "aDataSort": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol], @@ -671,6 +669,11 @@ oCol.sSortingClass = oClasses.sSortableDesc; oCol.sSortingClassJUI = oClasses.sSortJUIDescAllowed; } + else + { + oCol.sSortingClass = oClasses.sSortable; + oCol.sSortingClassJUI = oClasses.sSortJUI; + } }