Project

General

Profile

Feature #1293

Do not add sort on certain tables

Added by Marc Elbichon about 6 years ago.

Status:
新規(New)
Priority:
通常(Normal)
Assignee:
-
Category:
-
Target version:
-
Start date:
11/08/2013
Due date:
% Done:

0%

Estimated time:

Description

The automatic sorting of tables breaks table when rowspan is used in header.
I think adding this option on all tables is bad. Best is to select table to sort.
To do this, tables to be sorted could have a sortable class, so wiki_extensions.js should be

function wiki_extension_create_table_header() {
    var tbodys = $('.wiki table.sortable tbody');
    for (var i = 0; i < tbodys.length; i++) {
        var tbody = tbodys[i];
        if (!is_table_for_sort(tbody)) {
            continue;
        }
        var table = tbody.parentNode;
        var header = tbody.removeChild(tbody.firstChild);
        var thead = table.insertBefore(document.createElement('thead'), tbody);
        thead.appendChild(header);

    }

    $('table.sortable').each(function(i) {
        $(this).tablesorter();
    });

}

To sort a table, just do :

table(sortable)
|_. Header |_. Header |
...

Also available in: Atom PDF