Created
December 30, 2009 10:52
-
-
Save Riduidel/265975 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateSorter(tableId, columnIndex, order) { | |
return function(firstRow, secondRow) { | |
var firstText = getTextForCell(firstRow, columnIndex); | |
var secondText = getTextForCell(secondRow, columnIndex); | |
var returned = (firstTextsecondText ? 1 : 0)); | |
if(returned==0) { | |
// getSortOrder returns a 1-based sort index for this column | |
var columnSortIndex = getSortOrder(tableId, columnIndex); | |
if(columnSortIndex!="") { | |
columnSortIndex = columnSortIndex-1; | |
var sorting = currentSorting\[tableId\]; | |
// increment the column sort | |
if(sorting.length>++columnSortIndex) { | |
returned = generateSorter(tableId, sorting\[columnSortIndex\], 1)(firstRow, secondRow); | |
} | |
} | |
} | |
return order*returned; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment