19,667
edits
(back to this approach) |
(let's not be so cautious; somehow headerSort is not always getting applied before this function runs) |
||
| Line 535: | Line 535: | ||
if ($(theTable).hasClass("sortable") && $(theTable).hasClass("autosort")) | if ($(theTable).hasClass("sortable") && $(theTable).hasClass("autosort")) | ||
{ | { | ||
// 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 547: | Line 545: | ||
{ | { | ||
alert("Table " + j + " wants to sort by column " + col); | alert("Table " + j + " wants to sort by column " + col); | ||
// Now look for sort button and click it | // Now look for sort button and click it | ||
| Line 556: | Line 553: | ||
continue; | continue; | ||
} | } | ||
else if (allTHs.length < col) | |||
{ | { | ||
alert(" | alert("There are only " + allTHs.length + " 'th' elements!"); | ||
continue; | |||
} | } | ||
$(allTHs[col - 1]).trigger("click"); // use jQuery's trigger() to send click event to arrow button belonging to desired column | |||
} | } | ||
} | } | ||
| Line 578: | Line 567: | ||
} | } | ||
$( | $(sortSortableTables); | ||