...
sortTable = function(tableName, rowClass, columnNumber, ascending) {
var row, cell, cellContent;
var comparisonRow, comparisonCell, comparisonContent;
$("#" + tableName + " tr." + rowClass).each(function(i) {
row = $("#" + tableName + " tr." + rowClass + ":eq(" + i + ")");
cell = $(row).find("td:eq(" + columnNumber + ")");
cellContent = $(cell).html();
$("#" + tableName + " tr." + rowClass).each(function(j) {
comparisonRow = $("#" + tableName + " tr." + rowClass + ":eq(" + j + ")");
comparisonCell = $(comparisonRow).find("td:eq(" + columnNumber + ")");
comparisonContent = $(comparisonCell).html();
if ( (ascending && cellContent < comparisonContent) || (!ascending && cellContent > comparisonContent) ) {
$(row).insertBefore(comparisonRow);
return false;
}
});
});
};
: ( ) , HTML ( ) , ( ). ( , "" true), , .
...
sortTable("sample_table", "data_row", 0, true);
... , "data_row", "sample table", (, 0) .
...
, DataTables , TableSorter (, CSS , ), . (, ).