WordPress.org

Ready to get started?Download WordPress

Forums

TablePress
[resolved] Sorting of Special Characters (5 posts)

  1. be_dr
    Member
    Posted 1 year ago #

    Hi Tobias,

    when sorting rows using TablePress (with the Table Row Order extension) I find that cells starting with special characters (in this case umlauts) are placed at the end of the list. Is it possible to sort the table so that Ö follows O rather than Z. Maybe I am missing something obvious.

    Thanks.

    Grüße aus Berlin
    Oli

    http://wordpress.org/extend/plugins/tablepress/

  2. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Oli,

    thanks for your question!

    You are probably using a Shortcode like

    [table id=123 row_order=sort row_order_sort_column=A /]

    right?

    The sorting algorithm that is used for that is a "Natural Order String Comparison", using a PHP function: http://php.net/strnatcasecmp

    Unfortunately, I don't know if this function can be altered to sort Umlauts at different positions, and there doesn't seem to be a hint on this in the PHP documentation :-( Sorry.

    Regards,
    Tobias

  3. be_dr
    Member
    Posted 1 year ago #

    Hi Tobias,

    thanks for getting back to me. Yes, that is the Shortcode I am using. Okay, that's a shame that it's not an easy fix. However, many lists are sortable in the way I would like so I am sure there is some way of doing it. Maybe it will involve saving the initial data in another format. Thanks for the tip anyway and I will let you know if I find an answer!

    Oli

  4. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Oli,

    the table data is stored as a two-dimensional array. So, the sorting algorithm should be able to deal with that.
    And yes, if you find something, please let me know. I'll then gladly help to integrate it into the Extension.

    Regards,
    Tobias

  5. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi again :-)

    One idea: It might be possible that PHP uses the configured locale or language of the server to alter the behavior of the sorting. So, maybe there's a way to change that locale in the config, to alter the sorting behavior...

    Regards,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic