Forums

WP Table Reloaded - Default Sort (2 posts)

  1. touchsoundmusic
    Member
    Posted 9 months ago #

    Hello Tobias,

    Is it possible to choose the default column that will be sorted?

    Thanks in advance.

    -Tony J.

  2. TobiasBg
    Member
    Posted 9 months ago #

    Hi,

    yes, you could either perform an initial sort on the "Edit" screen of the table (so that the table will already be loaded in the sorted state that you want), or you can make the DataTables library sort the table immediately when it is loaded, by adding a "Custom Command" in the "DataTables JavaScript Features" section, like

    "aoColumnDefs": [ { "asSorting": [ "desc" ], "aTargets": [ 3 ] } ]

    (This would sort the table for column 4 (because of zero-based indexing), in descending order.)

    Regards,
    Tobias

Reply

You must log in to post.

About this Topic