Friday, January 29, 2010

Re: [jQuery] All of my columns are sorting fine, except one! It is acting as if there's a decimal point!

confirmed by looking at live site, $("#freeagents").get(0).config.parsers.8.id is "text". Looks like you'll have the same problem with "3B" as well for the same reason.

To force a specific parser to be used, pass the options in to Tablesorter on invocation. In this case for example:

jQuery("#freeagents").tablesorter({
  headers: {
    7: {
      sorter: 'digit'
      },
    8: {
      sorter: 'digit'
      }
    }
  });

You can collapse the white space if you wish but multiline makes it more readable, especially when you start adding other options (e.g. widgets, forced sort orders, ...).

e.g. jQuery("#freeagents").tablesorter({ headers: { 7: { sorter: 'digit' }, 8: { sorter: 'digit' }}});

Hope this helps,
aquaone


  
On Fri, Jan 29, 2010 at 16:15, mackrider <matstarS@gmail.com> wrote:

How do I do that exactly?

aquaone wrote:
>
> It's detecting it as text then most likely. Force it to sort numeric and
> you
> should be fine.
>
> On Fri, Jan 29, 2010 at 13:05, mackrider <matstarS@gmail.com> wrote:
>
>>
>> What's up?
>>
>> This is really odd.  One of my columns (HR) is not sorting properly.  It
>> is
>> sorting as if there's a decimal point.  Please go to
>> http://toiletsurvey.com/free-agents/  and on the first table sort by HR.
>>  It
>> sorts the numbers as such:
>>
>> 0
>> 0
>> 0
>> 0
>> 0
>> 0
>> 0
>> 0
>> 0
>> 0
>> 0
>> 0
>> 0
>> 0
>> 0
>> 1
>> 10
>> 10
>> 13
>> 13
>> 2
>> 2
>> 2
>> 2
>> 20
>> 24
>> 27
>> 31
>> 4
>> 6
>> 7
>> 7
>> 8
>> 8
>>
>>
>> Which leads me to believe for this one column, it's treating the numbers
>> as
>> if there's a decimal after the first digit.  If I hadd a zero to the
>> cells
>> it sorts properly.  I don't want to resort to using leading zero's
>> especially because the numbers can be in triple digits under certain
>> circumstances.  Please help!
>>
>> Thanks,
>>
>> Mack
>> --
>> View this message in context:
>> http://old.nabble.com/All-of-my-columns-are-sorting-fine%2C-except-one%21--It-is-acting-as-if-there%27s-a-decimal-point%21-tp27378273s27240p27378273.html
>> Sent from the jQuery General Discussion mailing list archive at
>> Nabble.com.
>>
>>
>
>

--
View this message in context: http://old.nabble.com/Tablesorter%3A-All-of-my-columns-are-sorting-fine%2C-except-one%21--It-is-acting-as-if-there%27s-a-decimal-point%21-tp27378273s27240p27380113.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.


No comments: