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 (v)
        {
                case "specialdate":
                        //do your stuff and set it to v
                        break;
                default:
                        v = $(node).html();
                        break;
        }
        return v;

};

On May 14, 7:37 am, Daniel Eriksson <[EMAIL PROTECTED]> wrote:
> (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:09 pm, Scott <[EMAIL PROTECTED]> wrote:
>
> > 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 and return a parseInt on it. The biggest problem
> > I had was youc an only specify 1 textExtraction function to use so I
> > added an attribute to the table cells to specify the kind of data then
> > my textExtraction function decided what to do based on that.
>
> > Example:
> > $.tablesorter.defaults.textExtraction = function (node)
> > {
> >         var r, v;
> >         try { v = node.attr("textExtraction"); }
> >         catch(e) { v = "none"; }
> >         switch (v)
> >         {
> >                 case "specialdate":
> >                         //do your stuff and set it to v
> >                         break;
> >                 default:
> >                         v = node.innerHTML;
> >                         break;
> >         }
> >         return v;
>
> > };
>
> > On May 13, 1:16 pm, Seth - TA <[EMAIL PROTECTED]> wrote:
>
> > > [Tried posting this, but never saw it go through. Sorry if it
> > > duplicates]
>
> > > I am having a couple issues with how to sort a few of my fields.
>
> > > The first, and I think most difficult is I have a field which holds
> > > the value of "Empty" or lists state abbreviations. What I'd like it to
> > > do is have "Empty" be grouped together and then sort the state
> > > abbreviations in alpha. I tried the grades demo, but with no success.
>
> > > The second is I have an ID field which is constructed by the year and
> > > then a sequential number.
> > > Example - 2008 - 1, 2008 - 2, 2008 - 3, etc.
> > > The problem is that when sorted itsortslike this...
> > > 2008 - 90, 2008 - 9, 2008 - 89
>
> > > It does see the 9 as coming after 8 and before 10, but between 90 and
> > > 89. Help with either one is greatly appreciated.
>
> > > Seth

Reply via email to