• Resolved zdavis

    (@zdavis)


    Currently, I have a table with columns full of images only. When someone clicks a heading to sort it all images in the column go to the bottom and all the blank cells show at the top. Click again and all images come to the top and all the blank rows go to the bottom. I was wondering if there was a way to switch this so that my first click shows the images? It could be by changing the sort to show descending before ascending or by changing how it handles images? Thanks for any help.

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    The only real way here would be to switch the sort order to first descending and then ascending.

    To do that, please add this to the “Custom Commands” textfield on the table’s “Edit” screen:

    "columnDefs": [ { "orderSequence": [ "desc", "asc" ], "targets": [ 1 ] } ]

    where the 1 is the column number of the column with images minus 1! (Thus, 1 indicates second column, 2 indicates third column, and so on. Counting the columns basically starts with 0 in this command.

    Regards,
    Tobias

    Thread Starter zdavis

    (@zdavis)

    Wow that’s quick response time. What you provided worked perfectly. Here’s what I ended up with.

    "columnDefs": [ { "orderSequence": [ "desc", "asc" ], "targets": [ 1,2 ,3,4] } ]

    Thanks for your help Tobias!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! 🙂 Good to hear that this helped!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sorting images’ is closed to new replies.