make PMA_changeClassForColumn work about 1/4th faster

This commit is contained in:
Piotr Przybylski
2011-03-10 18:48:16 +01:00
parent 149af3e687
commit a46a49b747

View File

@@ -998,10 +998,14 @@ function PMA_changeClassForColumn($this_th, newclass) {
var th_index = $this_th.index(); var th_index = $this_th.index();
// .eq() is zero-based // .eq() is zero-based
th_index--; th_index--;
var $tr_with_data = $this_th.closest('table').find('tbody tr ').has('td.data'); var $tds = $this_th.closest('table').find('tbody tr').find('td.data:eq('+th_index+')');
$tr_with_data.each(function() { if ($this_th.data('has_class_'+newclass)) {
$(this).find('td.data:eq('+th_index+')').toggleClass(newclass); $tds.removeClass(newclass);
}); $this_th.data('has_class_'+newclass, false);
} else {
$tds.addClass(newclass);
$this_th.data('has_class_'+newclass, true);
}
} }
$(document).ready(function() { $(document).ready(function() {