• Resolved thefatrumpirate

    (@thefatrumpirate)


    I have a Table which has a column which shows the amount of added sugar in grams.

    Unfortunately Tablepress does something similar to Excel and is sorting the data by the first digit of the number rather than the amount so it goes like this (this is just an example)

    1
    11
    2
    21
    3
    31

    Is there anyway I can change this? Please if this involves changes to the code let me know how it insert it all etc – I have not done anything like this before I just use Plug Ins – I have no coding skill or knowledge

    Thanks in advance

    https://wordpress.org/plugins/tablepress/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.
    Also, sorry for the long wait for a reply. As a I was on a long vacation without internet access the last couple weeks, I could not reply earlier.

    TablePress usually sorts such numbers just fine. In all cases when it doesn’t the problem was that not all cells in that column were plain numbers. Could that be the case here?

    Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!

    Regards,
    Tobias

    Hey Tobias!

    I’ve been having this problem too. So I guess it’s OK to bring this topic back up? Or will this bring unnecessary notifications to the original poster?

    (I have DataTables Sorting plugins Extension 1.0 activated, but didn’t do anything with it)

    Anyway…

    So first question/wish:
    I need some empty cells to be ignored, is that possible, so the rest gets sorted properly in a numeric way?

    Oddly(?), in the column in which some cells contain numbers with a decimal point (like 4.5), the empty cells ARE ignored. But in the others the sorting doesn’t appear as wanted.

    Check it out: http://bepakt.com/packaging-free-supermarkets/crowdfunding-index/
    Sorting “Weeks” works, but “Backers” doesn’t.

    Second question:
    Can I make it so that certain information is ignored in a cell, like the second line? In that way I could put extra information there.

    Thank you,
    Rutger http://www.bepakt.com

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    With “empty cells” ignored, do you mean that the cells that are empty should always be at the end?
    Unfortunately, I’m not aware of a solution for this. This is something that would probably have to be changed in the internal code of the DataTables JS library.

    For the second question, I recommend the approach from https://wordpress.org/support/topic/consolidating-columns-without-changing-sorting-options/ and https://wordpress.org/support/topic/how-to-sort-the-table-by-date/ i.e. a hidden column.

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Sorting Numerically in Tablepress’ is closed to new replies.