Hi, I'm trying to write a custom parser to sort column 5 of this table:
http://m100.marketocracy.com/tablesort/TC_test.html Column 5 can contain both positive and negative numbers. Negative numbers are supposed to be represented by enclosing the number in parenthesis (), and turning them red. So I've created a custom parser named "parenNegative" which is designed to recognize such numbers and convert them to a sortable form. Here's the code for the custom parser: ts.addParser({ id: "parenNegative", is: function(s) { $.tablesorter.log("at parenNegative"); return /\(.*\)</.test(s); }, format: function(s) { return jQuery.tablesorter.formatFloat(s.replace(/\((.*\))</g, "-$1<")); }, type: "numeric" }); And in pastie, in case it's formatted weird: http://www.pastie.org/564141 I put the parser in a custom version of jquery.tablesorter.js (named jquery.tablesorter_mtaco.js), which I call instead of jquery.tablesorter.js. The custom version is identical to the original version, aside from having my new parser and some slightly modified logging statements. I've verified that my custom version of jquery.tablesorter.js is what is being called. To verify, I turned on debugging, and added a new word to one of the existing benchmark statements. Unfortunately, my parser doesn't work, and I'm trying to figure out why. I tried to put in some logging statements, such as the $.tablesorter.log("at parenNegative"); statement above. However, none of the logging statements are ever raised when I reload the page. I've tried the following: $.tablesorter.log("message"); $.tablesorter.benchmark("message", time); log ("message"); I believe that the parser is being called because the debugging output lists the parenNegative parser for column 5. (See screenshot). Any suggestions? Thanks! Chris
<<inline: Picture 4.png>>