The branch, master has been updated via 676b0cc925482a0662562fca485fb4064b228a7f (commit) via ceee6082378c61b4e13e406a461c3990ccc09788 (commit) via e08ce9450bc99da18f4d74333a7dcd35aa33618d (commit) from 9f476c85a819af1cda160256a443d31c35f9951d (commit)
- Log ----------------------------------------------------------------- commit 676b0cc925482a0662562fca485fb4064b228a7f Author: Piotr Przybylski piotrprz@gmail.com Date: Thu Aug 18 15:34:57 2011 +0200
Refactor initTableSorter and use it only when needed
commit ceee6082378c61b4e13e406a461c3990ccc09788 Author: Piotr Przybylski piotrprz@gmail.com Date: Thu Aug 18 15:21:17 2011 +0200
Tablesorter: don't apply widget twice during initialization
commit e08ce9450bc99da18f4d74333a7dcd35aa33618d Author: Piotr Przybylski piotrprz@gmail.com Date: Thu Aug 18 14:59:15 2011 +0200
Faster zebra widget for tablesorter, reduces processing time of status variables table from ~200ms to ~100ms
-----------------------------------------------------------------------
Summary of changes: js/jquery/jquery.tablesorter.js | 6 ++- js/server_status.js | 69 +++++++++++++++++++++++--------------- js/server_status_monitor.js | 2 +- 3 files changed, 47 insertions(+), 30 deletions(-)
diff --git a/js/jquery/jquery.tablesorter.js b/js/jquery/jquery.tablesorter.js index e8e2323..909d947 100644 --- a/js/jquery/jquery.tablesorter.js +++ b/js/jquery/jquery.tablesorter.js @@ -826,9 +826,11 @@ // if user has supplied a sort list to constructor. if (config.sortList.length > 0) { $this.trigger("sorton", [config.sortList]); + } else { + // appendToTable used in sorton event already calls applyWidget + // apply widgets + applyWidget(this); } - // apply widgets - applyWidget(this); }); }; this.addParser = function (parser) { diff --git a/js/server_status.js b/js/server_status.js index 1d892e2..08d7679 100644 --- a/js/server_status.js +++ b/js/server_status.js @@ -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() { @@ -456,6 +473,7 @@ $(function() { } } }); + initTableSorter(tab.attr('id')); break;
case 'statustabs_allvars': @@ -463,43 +481,40 @@ $(function() { tab.find('.tabInnerContent').html(data); filterVariables(); } + initTableSorter(tab.attr('id')); break; } - - initTableSorter(tab.attr('id')); }
+ // TODO: tablesorter shouldn't sort already sorted columns function initTableSorter(tabid) { + var $table, opts; switch(tabid) { case 'statustabs_queries': - $('#serverstatusqueriesdetails').tablesorter({ - sortList: [[3, 1]], - widgets: ['zebra'], - headers: { - 1: { sorter: 'fancyNumber' }, - 2: { sorter: 'fancyNumber' } - } - }); - - $('#serverstatusqueriesdetails tr:first th') - .append('<img class="icon sortableIcon" src="themes/dot.gif" alt="">'); - + $table = $('#serverstatusqueriesdetails'); + opts = { + sortList: [[3, 1]], + widgets: ['fast-zebra'], + headers: { + 1: { sorter: 'fancyNumber' }, + 2: { sorter: 'fancyNumber' } + } + }; break; - case 'statustabs_allvars': - $('#serverstatusvariables').tablesorter({ - sortList: [[0, 0]], - widgets: ['zebra'], - headers: { - 1: { sorter: 'fancyNumber' } - } - }); - - $('#serverstatusvariables tr:first th') - .append('<img class="icon sortableIcon" src="themes/dot.gif" alt="">'); - + $table = $('#serverstatusvariables'); + opts = { + sortList: [[0, 0]], + widgets: ['fast-zebra'], + headers: { + 1: { sorter: 'fancyNumber' } + } + }; break; } + $table.tablesorter(opts); + $table.find('tr:first th') + .append('<img class="icon sortableIcon" src="themes/dot.gif" alt="">'); }
/* Filters the status variables by name/category/alert in the variables tab */ diff --git a/js/server_status_monitor.js b/js/server_status_monitor.js index 7ac2498..fa0f28e 100644 --- a/js/server_status_monitor.js +++ b/js/server_status_monitor.js @@ -1680,7 +1680,7 @@ $(function() {
$('div#logTable table').tablesorter({ sortList: [[cols.length - 1, 1]], - widgets: ['zebra'] + widgets: ['fast-zebra'] });
$('div#logTable table thead th')
hooks/post-receive