Order data in columns

Order data in columns

tgatarictgataric Posts: 4Questions: 2Answers: 0

Hi, is there an option to order filters in columns desceding? I have years column in datatable and in searchpanes column Year. I want to show year filter in searchpane desceding.

This question has accepted answers - jump to:

Answers

  • sandysandy Posts: 913Questions: 0Answers: 236
    Answer ✓

    Hi @tgataric ,

    SearchPanes used DataTables to display the options, so you can configure them using any DataTables configuration options by using searchPanes.dtOpts. I've written a live example as you've described.

    Hope this helps,
    Sandy

  • tgatarictgataric Posts: 4Questions: 2Answers: 0
    edited May 2020

    Hi @sandy.

    I modified your example and now is working :smile:

    $(document).ready( function () {
      
    var table = $('#example').DataTable( {
            searchPanes: {
                dtOpts: {
                    paging: true,
                    order: [[ 0, "desc" ]]
                }
            },
            dom: 'Pfrtip'
    });
    
      
    } );
    

    Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

  • sandysandy Posts: 913Questions: 0Answers: 236
    Answer ✓

    Sorry, I linked the wrong live page!

    That is the correct code though :)

This discussion has been closed.