diff --git a/js/server_status.js b/js/server_status.js
index 71f8f9453d..cb783d1b45 100644
--- a/js/server_status.js
+++ b/js/server_status.js
@@ -21,20 +21,6 @@ $(function() {
// Fixes wrong tab height with floated elements. See also http://bugs.jqueryui.com/ticket/5601
$(".ui-widget-content:not(.ui-tabs):not(.ui-helper-clearfix)").addClass("ui-helper-clearfix");
- // Enable table sorting
- $('#serverstatusvariables')
- .tablesorter({
- sortList: [[0,0]],
- widgets: ['zebra']
- });
- $('#serverstatusqueriesdetails')
- .tablesorter({
- sortList: [[3,1]],
- widgets: ['zebra']
- });
-
- $('#serverstatusqueriesdetails tr:first th, #serverstatusvariables tr:first th').append('
');
-
// Load chart asynchronly so the page loads faster
$.get($('#serverstatusquerieschart a').first().attr('href'),{ajax_request:1}, function(data) {
$('#serverstatusquerieschart').html(data);
@@ -42,6 +28,10 @@ $(function() {
imageMap.init();
});
+ // Table sorting
+ initTableSorter('statustabs_queries');
+ initTableSorter('statustabs_allvars');
+
// Ajax reload of variables (always the first link)
$('.statuslinks a:nth-child(1)').click(function() { return refreshHandler(this); });
// Realtime charting of variables (always the second link)
@@ -114,6 +104,8 @@ $(function() {
filterVariables();
break;
}
+
+ initTableSorter(tab.attr('id'));
}
function refreshHandler(element) {
@@ -133,6 +125,32 @@ $(function() {
return false;
}
+ function initTableSorter(tabid) {
+ switch(tabid) {
+ case 'statustabs_queries':
+ $('#serverstatusqueriesdetails').tablesorter({
+ sortList: [[3,1]],
+ widgets: ['zebra']
+ });
+
+ $('#serverstatusqueriesdetails tr:first th')
+ .append('
');
+
+ break;
+
+ case 'statustabs_allvars':
+ $('#serverstatusvariables').tablesorter({
+ sortList: [[0,0]],
+ widgets: ['zebra']
+ });
+
+ $('#serverstatusvariables tr:first th')
+ .append('
');
+
+ break;
+ }
+ }
+
function filterVariables() {
var useful_links=0;
var section = text;