Hi All,

if anyone else is interested in a similar tablesorter extension - heres the
code

#####code######
$.tableSorter.parsers.englishNumber = {
       id: 'englishNumber',
       is: function(s) {
               return s.match(/^\d{1,3}(\,\d{1,3})+(\.\d{2})?\s*$/);
       },
       format: function(s) {
               return parseFloat(s.replace(/[^0-9.]/g,''));
       },
       sorter: $.tableSorter.sorters.numeric
};

$.tableSorter.analyzer.add($.tableSorter.parsers.englishNumber);
#############

note: if this could be added by default to newer releases of tablesorter it
wold be great
note: matches 45,233.00 not $45,456.09 (this one left for the default
currency type)
note: the currency type can be extended to match similar patterns
               return s.match
(/^\s*[£$]?\s*\d{1,3}(\,\d{1,3})+(\.\d{2})?\s*$/);

cheers

justin


On 2/4/07, Chris Domigan <[EMAIL PROTECTED]> wrote:

I think the tablesorter plugin is fairly easy to extend with custom
regexes, if you're up for it! Or you could just use the existing regex and
get it to strip all commas before the comparison.

Chris

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to