Reinitalize tablesorter after refresh

This commit is contained in:
Tyron Madlener 2011-06-01 11:21:45 +02:00
parent 8d5850674b
commit f76b91fdb1

View File

@ -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('<img class="sortableIcon" src="'+pma_theme_image+'cleardot.gif" alt="">');
// 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('<img class="sortableIcon" src="'+pma_theme_image+'cleardot.gif" alt="">');
break;
case 'statustabs_allvars':
$('#serverstatusvariables').tablesorter({
sortList: [[0,0]],
widgets: ['zebra']
});
$('#serverstatusvariables tr:first th')
.append('<img class="sortableIcon" src="'+pma_theme_image+'cleardot.gif" alt="">');
break;
}
}
function filterVariables() {
var useful_links=0;
var section = text;