Title: Default sort almost sorted&#8230;
Last modified: September 5, 2020

---

# Default sort almost sorted…

 *  Resolved [thrillhouse](https://wordpress.org/support/users/thrillhouse/)
 * (@thrillhouse)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/default-sort-almost-sorted/)
 * Hi Tobias,
    Sorry to bother you.
 * In a typically amateur & barbaric way, I have the following in column C.
 * <button onclick=”window.location.href=’/ad/vanalive'”>[su_post field=”4890″ before
   =”£” default=”—-” post_id=”4834″ post_type=”acadp_fields”]</button>
 * It returns prices fro users post.
    I have installed DataTables Sorting & Table
   Row Order.
 * **THE ISSUE**
    When I sort column C in admin side, if field=”4890″ is empty, 
   it returns £—- which is considered a higher value. It’s top when default sorting
   by descending. Should be bottom. Even if no value in the button.
 * However, when I sort column C header on frontend, it works great perfectly. So
   it seems to recognise my ham fisted approach 🙂
 * So it know that £— is lower than £100, but not on default.
 * 1) Any way this can recognise that the default value is lowest value?
 * Many thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdefault-sort-almost-sorted%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/default-sort-almost-sorted/#post-13365992)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * The sorting on the admin side actually does not sort the returned values, but
   that HTML/Shortcode string as text.
 * As for the frontend side, I’m not aware of an easy way to change this, sorry 
   🙁 You’d probably need a custom sorting algorithm for the DataTables JS library.
   You could of course maybe try using a different default value in your Shortcode,
   by changing that `—-` to 0 or so.
 * Regards,
    Tobias
 *  Thread Starter [thrillhouse](https://wordpress.org/support/users/thrillhouse/)
 * (@thrillhouse)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/default-sort-almost-sorted/#post-13366066)
 * No worries. Many thanks.
 * Since it recognises whats high and low correctly when you click sort on front
   end…
    Is there a way that it sorts descending first when clicking column header?
   Right now its ascending first then click again for descending. So its 2 clicks
   to get highest price.
 * Can we do it in 1 click? Can I swap it?
 * Many thanks. Its appreciated.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/default-sort-almost-sorted/#post-13366084)
 * Hi,
 * yes, swapping is possible! For that, please add this to the “Custom Commands”
   text field on the table’s “Edit” screen:
 *     ```
       "columnDefs": [ { "orderSequence": [ "desc", "asc" ], "targets": [ 2 ] } ]
       ```
   
 * Regards,
    Tobias
 *  Thread Starter [thrillhouse](https://wordpress.org/support/users/thrillhouse/)
 * (@thrillhouse)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/default-sort-almost-sorted/#post-13366422)
 * You’re a star. I read the forum and I entered it like this.
    **How do I separate
   the commands?**… (I’m not lazy believe me. I google and read forums but often
   the answers aren’t noob useful). You’re great though.
 * “language”: { “search”: “”, “searchPlaceholder”: “Filter by County…”, “lengthMenu”:“
   _MENU_”}
 * “columnDefs”: [ { “orderSequence”: [ “desc”, “asc” ], “targets”: [ 2 ] } ]
 * Thanks.
 *  Thread Starter [thrillhouse](https://wordpress.org/support/users/thrillhouse/)
 * (@thrillhouse)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/default-sort-almost-sorted/#post-13366452)
 * Don’t worry. It’s a ,
    I found it on your support. You’ve answered it before.
   Thanks for all your help.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/default-sort-almost-sorted/#post-13368710)
 * 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](https://wordpress.org/support/plugin/tablepress/reviews/#new-post)
   here in the plugin directory. Thanks!

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

The topic ‘Default sort almost sorted…’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [5 years, 9 months ago](https://wordpress.org/support/topic/default-sort-almost-sorted/#post-13368710)
 * Status: resolved