On 2/6/07, Jonathan Freeman <[EMAIL PROTECTED]> wrote:

Yes, thank you, much clearer. I will look into writing a custom parser,
since sticking to one data type is not an option. I'm assuming writing
parsers are pretty straight forward.


In this case the custom parser could look something like this.

jQuery.tableSorter.parsers.key = {
   id: 'key',
   // this will only return true, if a numeric "string" is present, use
columnParser for specific column
   is: function(s) {
       return s.match(/^\b\d+\b$/);
   },
   format: function(s) {
       var val = parseFloat(s);
       if(!val) {
           val = 0;
       }
       return val;
   },
   sorter: $.tableSorter.sorters.numeric
};
jQuery.tableSorter.analyzer.add(jQuery.tableSorter.parsers.key);


Then in the constructor just add:

columnParser: [[0,'key']]

Where the syntax is [columnIndex,parserId]

What confused me, was FF was not throwing any errors. And we do have very
similar tables with numbers and text blocks where IE doesn't throw the
error but render it as expected.


I'm guessing that parseInt / parseFloat behaves diffrently in IE / FF


Thanks for the great plugin, you have no idea how much this has saved on
our server performance.


No problem, i'm glad that i solves problems.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to