sorttable bug: user-sort-function

Allow people to supply their own sort functions for a column. They have to have a way of:

  1. defining the function
  2. telling sorttable about it
  3. hooking it up to a column

I’m inclined to suggest that you can only apply a custom sort function to a column with a manual override; guessType won’t ever guess it. That way we don’t have to worry about
clashing regexps and the order of matches, etc. Applying a custom function would do something like this:

<script type=“text/javascript”>
function my_custom_sorter(a,b) {
// sort by the second letter of each string!
var aa = a.substr(1);
var bb = b.substr(1);
if (aa==bb) return 0;
if (aa<bb) return -1;
return 1;
}

sorttable.addSortFunction(my_custom_sorter);
</script>

<table class=“sortable”>
<thead>
<tr><th>Sort ordinary</th> <th class=“sorttable_my_custom_sorter”>Custom</th></tr>

Back to the sorttable bug list

Email me when this bug gets updated: · privacy · powered by ChangeDetection