Faster zebra widget for tablesorter, reduces processing time of status variables table from ~200ms to ~100ms

This commit is contained in:
Piotr Przybylski 2011-08-18 14:59:15 +02:00
parent 9f476c85a8
commit e08ce9450b
2 changed files with 21 additions and 4 deletions

View File

@ -43,7 +43,24 @@ $(function() {
},
type: "numeric"
});
// faster zebra widget: no row visibility check, faster css class switching, no cssChildRow check
jQuery.tablesorter.addWidget({
id: "fast-zebra",
format: function (table) {
if (table.config.debug) {
var time = new Date();
}
$("tr:even", table.tBodies[0])
.removeClass(table.config.widgetZebra.css[0])
.addClass(table.config.widgetZebra.css[1]);
$("tr:odd", table.tBodies[0])
.removeClass(table.config.widgetZebra.css[1])
.addClass(table.config.widgetZebra.css[0]);
if (table.config.debug) {
$.tablesorter.benchmark("Applying Fast-Zebra widget", time);
}
}
});
// Popup behaviour
$('a[rel="popupLink"]').click( function() {
@ -474,7 +491,7 @@ $(function() {
case 'statustabs_queries':
$('#serverstatusqueriesdetails').tablesorter({
sortList: [[3, 1]],
widgets: ['zebra'],
widgets: ['fast-zebra'],
headers: {
1: { sorter: 'fancyNumber' },
2: { sorter: 'fancyNumber' }
@ -489,7 +506,7 @@ $(function() {
case 'statustabs_allvars':
$('#serverstatusvariables').tablesorter({
sortList: [[0, 0]],
widgets: ['zebra'],
widgets: ['fast-zebra'],
headers: {
1: { sorter: 'fancyNumber' }
}

View File

@ -1680,7 +1680,7 @@ $(function() {
$('div#logTable table').tablesorter({
sortList: [[cols.length - 1, 1]],
widgets: ['zebra']
widgets: ['fast-zebra']
});
$('div#logTable table thead th')