• Resolved thrillhouse

    (@thrillhouse)


    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 to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    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

    (@thrillhouse)

    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

    (@tobiasbg)

    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

    (@thrillhouse)

    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

    (@thrillhouse)

    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

    (@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 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Default sort almost sorted…’ is closed to new replies.