From 5cd7b33df7c0ba37820a9b9f1638958a9ffa3f01 Mon Sep 17 00:00:00 2001 From: Mottie Date: Fri, 10 Oct 2014 07:54:17 -0500 Subject: [PATCH] Core: get column index from data-attribute when sorting --- js/jquery.tablesorter.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index 280a35c8..c8d5966b 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -459,6 +459,7 @@ $(this).html('
' + t + '
'); // faster than wrapInner } if (c.onRenderHeader) { c.onRenderHeader.apply($t, [index, c, c.$table]); } + // *** remove this.column value if no conflicts found this.column = parseInt( $(this).attr('data-column'), 10); this.order = formatSortingOrder( ts.getData($t, ch, 'sortInitialOrder') || c.sortInitialOrder ) ? [1,0,2] : [0,1,2]; this.count = -1; // set to -1 because clicking on the header automatically adds one @@ -649,7 +650,7 @@ }); } // get current column index - indx = cell.column; + indx = parseInt( $(cell).attr('data-column'), 10 ); // user only wants to sort on one column if (key) { // flush the sort list