WordPress.org

Forums

TablePress
[resolved] Sort feature on just a few columns, not all? (6 posts)

  1. etrnluv
    Member
    Posted 2 years ago #

    I was wondering if I can limit the sorting ability to just a few of my columns, instead of all of them. My client just wants a few of their columns "sortable". Is this possible?
    Thanks!
    Angie

    It is a dev site at the moment, but here is the page.

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

  2. TobiasBg
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    thanks for the question.

    Yes, you can turn off sorting on certain columns with a "Custom Command" for the DataTables JavaScript library (which TablePress uses for the sorting feature).

    For example, paste

    "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 0, 1, 4 ] } ]

    into the "Custom Commands" textfield on the table's "Edit" screen.

    This would turn off sorting for columns 1, 2, and 5. (The counting of the numbers in the code starts with 0.)

    Regards,
    Tobias

  3. etrnluv
    Member
    Posted 2 years ago #

    WOW!
    Thanks for the super fast response...it is 4am here...LOL I appreciate your help!

  4. TobiasBg
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    no problem, you are very welcome! :-) Good to hear that this helped!

    Best wishes,
    Tobias

  5. Pankaj Asopa
    Member
    Posted 2 years ago #

    Thank you so much I was looking for the same....

  6. TobiasBg
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    cool! Great to hear that this was helpful for you as well!

    Best wishes,
    Tobias

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • TablePress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.