Commit e8592249 authored by Mike Hibler's avatar Mike Hibler

Call init() method in makeSortable() to fix broken table sorting.

This is needed due to the odd way in which we use sorttable.
In normal use, sorttable.init would be called via the DOMContentLoaded
event hook and this would invoke makeSortable() to do the DOM magic
necessary to ensure all tables marked sortable are make sortable.

But due to our use of AJAX-y dynamic content loading, this won't work
(or so I am told!) So we generate our own call to makeSortable(mytable)
when we produce any sortable table "mytable". But if init() has not been
called before that first call to makeSortable, the DATE_RE regex will
not be initialized and strange things happen in guessType and consequently,
in the sort functions themselves.
parent 7d3069b4
......@@ -40,6 +40,10 @@ sorttable = {
makeSortable: function(table) {
// XXX hack for explicit calls to makeSortable in Emulab:
// make sure DATE_RE is defined, else guessType will do strange things.
if (table.getElementsByTagName('thead').length == 0) {
// table doesn't have a tHead. Since it should have, create one and
// put the first table row in it.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment