WordPress.org

Ready to get started?Download WordPress

Forums

TablePress
[resolved] Sorting difficulties: Column contains only HTML IMG tags (3 posts)

  1. epretorious
    Member
    Posted 6 months ago #

    Hi, Tobias:

    I've run into something unexpected: TablePress/DataTables won't sort a column that contains only HTML IMG tags.

    Is there something special that I need to do to make all of the columns in this table sortable?

    TIA,
    Eric P.

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

  2. epretorious
    Member
    Posted 6 months ago #

    BTW: The "Wildcard" column is the column that I'm referring to. (It's the only column with 100% images. The others have one or two cells that contain "n/a".)

    Eric P.

  3. TobiasBg
    Member
    Plugin Author

    Posted 6 months ago #

    Hi,

    thanks for your post, and sorry for the trouble.

    When sorting, HTML code is stripped before the sorting, which leaves that image column with empty strings.
    One workaround would be to not actually do the sorting on the image column, but on a hidden column next to it, that contains e.g. strings or numbers.
    You can find examples for this idea (they don't use image HTML code, but fixed strings instead of numbers, where this idea also works) in these threads:
    http://wordpress.org/support/topic/sorting-a-column-with-a-custom-date-format
    http://wordpress.org/support/topic/arranging-columns-by-data
    http://wordpress.org/support/topic/substitute-word-for-numbers-for-sorting-issues

    Regards,
    Tobias

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.