Skip to content

Instantly share code, notes, and snippets.

View danielsokolowski's full-sized avatar

Daniel Sokolowski danielsokolowski

View GitHub Profile
@danielsokolowski
danielsokolowski / tablesort.js
Last active August 27, 2015 02:57 — forked from scopevale/fiddle.css
jsFiddle demo - Table Sort (vanilla JS)
function TableSort(oTableElement) {
this.tbl = oTableElement;
this.lastSortedTh = null;
if (this.tbl && this.tbl.nodeName == "TABLE") {
var headings = this.tbl.tHead.rows[0].cells;
for (var i=0; headings[i]; i++) {
if (headings[i].className.match(/asc|dsc/)) {
this.lastSortedTh = headings[i];
}
}