WordPress.org

Ready to get started?Download WordPress

Forums

Tablepress thousands separator problem (12 posts)

  1. kancur
    Member
    Posted 4 months ago #

    My table: http://www.good3dprojector.com/best-3d-hd-projector/

    The problem is the contrast ratio column. It's working except the 1,000,000 number

    Actually ideal would be if I can put there values like this: 15,000:1 and to sort only by the first number = 15,000 but that is not priority :-) thanks for your help, I can't figure out how to make it work

  2. TobiasBg
    Member
    Posted 4 months ago #

    Hi,

    thanks for your post, and sorry for the trouble.

    You are right, numbers with a comma as a thousand separator will not work out of the box, as the comma makes those numbers strings, and strings are sorted differently. To work around that, please install the TablePress Extension from http://tablepress.org/extensions/datatables-sorting-plugins/ and add this to the "Custom Commands" textfield on the "Edit" screen of the table:

    "aoColumnDefs": [ { "sType": "formatted-num", "aTargets": [ 1, 3 ] } ]

    Regards,
    Tobias

  3. kancur
    Member
    Posted 4 months ago #

    Thanks for your response, I have already tried it. It's not working for me :-/ But the currency column is working without problem. Only problem seems to be the 1,000,000 number. Sorry I'm a beginner in wordpress and so on

  4. kancur
    Member
    Posted 4 months ago #

    I reuploaded that plugin to be sure. No change.
    Here is another example http://www.good3dprojector.com/test-page/
    Password:123

    This is the code I put in Custom commands:
    "aoColumnDefs": [ { "sType": "formatted-num", "aTargets": [ 6 ] } ]

    Still it seems that numbers with , as thousands separator are treated as if , is a decimal separator! I don't get it.

    Thank you very much for spending your time on this :-)

  5. TobiasBg
    Member
    Posted 4 months ago #

    Hi,

    from what I can see, you are using a second piece of JavaScript for the sorting, besides the DataTables library that TablePress uses.
    Namely, there's a "jquery.tablesorter.js" script being loaded. My assumption is that that is interfering right now, so please turn that off again so that we can further investigate this.

    Regards,
    Tobias

  6. kancur
    Member
    Posted 4 months ago #

    Oh yeah!! :) Thank you, sorry I'm a total newbie in this.
    Thank you very much! Your plugin is awesome!

  7. TobiasBg
    Member
    Posted 4 months ago #

    Hi,

    no problem, you are very welcome! :-) Good to hear that this helped!

    Best wishes,
    Tobias

  8. kancur
    Member
    Posted 4 months ago #

    :-) I have one more question, can you suggest me a solution to sorting column: Resolution
    It could be based on sorting just the first number before x character.
    or maybe x could work as a multiplication ...

  9. kancur
    Member
    Posted 4 months ago #

    (Somehow the link is not visible in previous post)
    Link:
    http://www.good3dprojector.com/

  10. TobiasBg
    Member
    Posted 4 months ago #

    Hi,

    sorry, unfortunately, I don't have a solution to that. That's a similar problem as sorting for those ratios with the :. You would need to develop a custom sorting algorithm in JavaScript that extracts that number from the cell and uses it for the sorting, similar to the other algorithms in the Sorting Plugins Extension.

    Regards,
    Tobias

  11. kancur
    Member
    Posted 4 months ago #

    Anyway, thank you very much :-)

  12. TobiasBg
    Member
    Posted 4 months ago #

    Hi,

    sure, no problem! Sorry that I couldn't help with that.

    Regards,
    Tobias

Reply

You must log in to post.

About this Topic