1 // TODO: tablesorter shouldn't sort already sorted columns
2 function initTableSorter(tabid) {
5 case 'statustabs_queries':
6 $table = $('#serverstatusqueriesdetails');
9 widgets: ['fast-zebra'],
11 1: { sorter: 'fancyNumber' },
12 2: { sorter: 'fancyNumber' }
17 $table.tablesorter(opts);
18 $table.find('tr:first th')
19 .append('<div class="sorticon"></div>');
23 $.tablesorter.addParser({
26 return (/^[0-9]?[0-9,\.]*\s?(k|M|G|T|%)?$/).test(s);
28 format: function (s) {
29 var num = jQuery.tablesorter.formatFloat(
30 s.replace(PMA_messages.strThousandsSeparator, '')
31 .replace(PMA_messages.strDecimalSeparator, '.')
35 switch (s.charAt(s.length - 1)) {
39 // Todo: Complete this list (as well as in the regexp a few lines up)
54 return num * Math.pow(10, factor);
59 $.tablesorter.addParser({
60 id: "withinSpanNumber",
62 return (/<span class="original"/).test(s);
64 format: function (s, table, html) {
65 var res = html.innerHTML.match(/<span(\s*style="display:none;"\s*)?\s*class="original">(.*)?<\/span>/);
66 return (res && res.length >= 3) ? res[2] : 0;
71 // faster zebra widget: no row visibility check, faster css class switching, no cssChildRow check
72 $.tablesorter.addWidget({
74 format: function (table) {
75 $("tr:even", table.tBodies[0])
76 .removeClass(table.config.widgetZebra.css[0])
77 .addClass(table.config.widgetZebra.css[1]);
78 $("tr:odd", table.tBodies[0])
79 .removeClass(table.config.widgetZebra.css[1])
80 .addClass(table.config.widgetZebra.css[0]);