column widget code cleanup

This commit is contained in:
Mottie 2013-10-03 09:34:07 -05:00
parent 2993069e04
commit ecf9693354

View File

@ -287,23 +287,19 @@ ts.addWidget({
ts.processTbody(table, $tb, false); ts.processTbody(table, $tb, false);
} }
// add classes to thead and tfoot // add classes to thead and tfoot
$tr = wo.columns_thead !== false ? 'thead tr' : ''; $tr = wo.columns_thead !== false ? ['thead tr'] : [];
if (wo.columns_tfoot !== false) { if (wo.columns_tfoot !== false) {
$tr += ($tr === '' ? '' : ',') + 'tfoot tr'; $tr.push('tfoot tr');
} }
if ($tr.length) { if ($tr.length) {
$t = $tbl.find($tr).children().removeClass(rmv); $t = $tbl.find($tr.join(',')).children().removeClass(rmv);
if (list && list[0]){ if (len){
// primary sort column class for (i = 0; i < len; i++){
$t.filter('[data-column="' + list[0][0] + '"]').addClass(css[0]); // add primary. secondary, tertiary, etc sort column classes
if (len > 1){
for (i = 1; i < len; i++){
// secondary, tertiary, etc sort column classes
$t.filter('[data-column="' + list[i][0] + '"]').addClass(css[i] || css[last]); $t.filter('[data-column="' + list[i][0] + '"]').addClass(css[i] || css[last]);
} }
} }
} }
}
if (c.debug){ if (c.debug){
ts.benchmark("Applying Columns widget", time); ts.benchmark("Applying Columns widget", time);
} }