Hi Justin,

I will see to it that this get included in the contributed parser file
planed for the new release.

Cheers
Christian


On 2/5/07, justin kelly <[EMAIL PROTECTED]> wrote:

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 tablesorterit 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/


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

Reply via email to