• Resolved jimlord

    (@jimlord)


    When a user clicks to sort a column, it is cycling through what appears to be a text ascending, numeric ascending, and text descending. This can most easily be seen in the “Division II” standings on the page at https://collegestunt.org/rankings/ where we have numbers into the teens. The initial table is correct, as we have it sorted properly in the original table. If one sorts by team alphabetically and then goes back to sort the ranking, it puts it in order of “1, 10, 11, 12… 18, 2, 3, 4” when first clicked. If they click again, it goes descending, and then click again to get it how it should be seen. Is there a way to force a sort to always be numeric? (hope I got that right)

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter jimlord

    (@jimlord)

    I actually just added another column on a test table and it looks like it’s actually cycling through ascending, descending, and then original order as displayed. We just happen to have it in the right order originally so that’s what is showing up. That can be seen by sorting the two different ranking columns here: https://collegestunt.org/testrankings/

    I have TablePress Pro.

    • This reply was modified 3 weeks, 5 days ago by jimlord.
    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi Jim!

    Thanks for your post and sorry for the trouble!

    Your observation is correct: The sorting is “ascending” -> “descending” -> “original order” and so on.

    Now, the cause for the wrong order here is that some cells actually contain text and not just numbers, namely “NR” or things like “… (tie)”. This switches the sorting algorithm to text string sorting, where “10” is then sorted between “1” and “2”.

    The question now is how you would like to treat this. My personal feeling would be to actually simply turn off sorting for that Rank column (and also the second column, with the team logo). For that, you could add this to the “Custom Commands” text field on the table’s “Edit” screen:

    columnDefs: [
    { orderable: false, targets: [ 0, 1 ] },
    ],

    Best wishes,
    Tobias

    Thread Starter jimlord

    (@jimlord)

    I started to realize that when testing some other stuff. I think my best option maybe to keep the numbers in one column and add any text in a second column right next to it and try to size those columns to be minimum width.
    One problem I found with this approach is that if I don’t have anything in the rank column, then that blank cell gets sorted first instead of last. I’ll play around with these options and if I find a good solution I’ll repost here in case anybody else can use a solution. Thanks so much for always being so responsive!!! Best plug-in and developer on the planet.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi Jim,

    We could actually also use a custom sorting that will always keep “NR” entries at the bottom. However, as this concerns the TablePress premium support, I would please need to get you in touch via email, to the address that you can find on the “About” screen of TablePress on your site.

    Best wishes,
    Tobias

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.