19,667
edits
(still trying to get sorter to run after page totally loads) |
(restoring safer code, it doesn't make a difference) |
||
| Line 535: | Line 535: | ||
if ($(theTable).hasClass("sortable") && $(theTable).hasClass("autosort")) | if ($(theTable).hasClass("sortable") && $(theTable).hasClass("autosort")) | ||
{ | { | ||
var sortColumnNum = 1, curColumnNum = 0; | |||
// First check if there is any by-column-x class at all, then take the time to figure out the value of x | // First check if there is any by-column-x class at all, then take the time to figure out the value of x | ||
var patt = /by-column/; | var patt = /by-column/; | ||
| Line 545: | Line 547: | ||
{ | { | ||
//alert("Table " + j + " wants to sort by column " + col); | //alert("Table " + j + " wants to sort by column " + col); | ||
sortColumnNum = col; | |||
// Now look for sort button and click it | // Now look for sort button and click it | ||
| Line 553: | Line 556: | ||
continue; | continue; | ||
} | } | ||
for (var k = 0; k < allTHs.length; k++) | |||
{ | { | ||
alert(" | //alert("Class names for 'th' # " + k + " are " + allTHs[k].className); | ||
if ($(allTHs[k]).hasClass("headerSort")) | |||
{ | |||
curColumnNum++; | |||
if (curColumnNum == sortColumnNum) | |||
{ | |||
alert("Clicking sort button (ID " + k + ") for column " + sortColumnNum); | |||
$(allTHs[k]).trigger("click"); // use jQuery's trigger() to send click event to this arrow | |||
return; | |||
} | |||
} | |||
} | } | ||
} | } | ||
} | } | ||
| Line 567: | Line 578: | ||
} | } | ||
$(sortSortableTables); | |||