[jQuery] Re: Tablesorter - Custom Sorts

2008-05-14 Thread Scott
Yeah, probably for his case you're right, but the parser is given the innerHTML of the node and if you've got other html elements in the node you end up with a rather messy string to parse. If the parser was just passed the node itself or be able to set a flag for what form you want your argument

[jQuery] Re: Tablesorter - Custom Sorts

2008-05-14 Thread tlphipps
I'm pretty sure the recommended way to achieve this is to use the "addParser" functionality. Then you can specify which fields should use your custom parser using either metadata or options. Overriding the textExtraction seems like using a sledgehammer to me rather than a precision tool. On May

[jQuery] Re: Tablesorter - Custom Sorts

2008-05-14 Thread Scott
Yeah, sorry, forgot I was switching between jquery and non-jquery syntax. I'll make it all jquery so it is consistent. $.tablesorter.defaults.textExtraction = function (node) { var r, v; try { v = $(node).attr("textExtraction"); } catch(e) { v = "none"; } switch (

[jQuery] Re: Tablesorter - Custom Sorts

2008-05-14 Thread Daniel Eriksson
I can't get your example to work. When I try to debug by adding this line: var r, v; console.log(node.attr("textExtraction")); try { v = node.attr("textExtraction"); } I get the error "node.attr is not a function". /Daniel On Tue, May 13, 2008 at 11:09 PM, Scott <[E

[jQuery] Re: Tablesorter - Custom Sorts

2008-05-14 Thread Daniel Eriksson
(I hope I didn't double post this) I can't get your example to work. When I try to debug by adding this line: var r, v; console.log(node.attr("textExtraction")); try { v = node.attr("textExtraction"); } I get the error "node.attr is not a function". On May 13, 11:0

[jQuery] Re: Tablesorter - Custom Sorts

2008-05-13 Thread Scott
I've been working with the Tablesorter plugin recently and had to do something similar. You can make your own textExtraction function and use it to extract an organize the data how you want. In your case I'd probably do something where you parse out just the numbers, zero pad them, concat together