We're Moving to a New Support Platform – Starting June 1st!

We’re excited to let you know that starting June 1st, we’ll be transitioning to a new support system that will be available directly on our product websites – Amelia, wpDataTables, and Report Builder. In fact, the new support platform is already live for Amelia and wpDataTables, and we encourage you to reach out to us there.

You'll always be able to reach us through a widget in the bottom right corner of each website, where you can ask questions, report issues, or simply get assistance.

While we still do not offer live support, a new advanced, AI-powered assistant, trained on our documentation, use cases, and real conversations with our team, is there to help with basic to intermediate questions in no time.

We're doing our best to make this transition smooth and hassle-free. After June 1st, this current support website will redirect you to the new "Contact Us" pages on our product sites.

Thanks for your continued support and trust – we’re excited to bring you an even better support experience!

Okay
  Public Ticket #2926440
Auto Descending Sort Order
Closed

Comments

  • Ed Kraft started the conversation

    Hey Guys,

    I have a table similar to the Premier league table, with point totals across multiple columns.  When I click the header to sort each rounds, the default sort order is ascending (showing the lowest point totals first).  Can I make the default sort order descending for these columns?  Within the editor, the only way I see how to do this is making each column sortable on load, where the option for ascending or descending exists.  However I only want to sort by total points on load of the table, not every column.

    Within regular data tables, the code would look something like this:

    { "orderSequence": [ "desc", "asc"], "targets": [ 4, 6, 8, 10, 12 ] }, // set column sort order for points to descending when clicked

    That code sets the default sort order to 'descending' for those columns.  Can I do that with custom JS here as well?

    Thanks.

  •  472
    Isidora replied

    Hi Ed,

    Thank you for your purchase.

    Sorry for the late response, we have some agents that have contracted Covid-19, so our team is cut in half.

    Your request require custom solution.

    1) You can use hook wpdatatables_filter_table_description(available filters)

    wpdatatables_filter_table_description( $object, $tableId, wpDataTableObject )

    This filter is applied to an object (PHP’s StdObj), which is later printed as a table’s data attribute (json_encoded), and used to initialize the DataTables instance, and to describe other table settings and parameters that are used by the frontend JS library.

    $object is the PHP StdObj which contains all the necessary fields for initializing the table

    $tableId is the table identifier from the MySQL table (wp_wpdatatables)

    $wpDataTableObject is the WPDataTable object

    2) You can use Datatable API over wpDataTables object. All wpDataTables existing on the page are reflected in the global JavaScript object called ‘wpDataTables‘. If you check this variable in the JS developer console you will see the wpDataTables as properties of this object. More info.


    Please note that using wpDataTable hooks and callbacks requires certain level of programming skills and included support refers only to advice.

    Best regards.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables