Descending Column

Descending Column

NaughtyBoy21NaughtyBoy21 Posts: 2Questions: 1Answers: 0
edited October 2021 in General

How to auto descending this column after refresh page.?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583
    edited October 2021 Answer ✓

    If you mean a default ordering on the table, you can use order, so something like order: [[0, 'desc']],

    Colin

  • NaughtyBoy21NaughtyBoy21 Posts: 2Questions: 1Answers: 0
    <script>
        $(document).ready(function() {
            var table = $('#table').DataTable( {
                buttons: [ 'copy','csv','print', 'excel', 'pdf', 'colvis' ],
                dom: 
                "<'row'<'col-md-3'l><'col-md-5'B><'col-md-4'f>>" +
                "<'row'<'col-md-12'tr>>" +
                "<'row'<'col-md-5'i><'col-md-7'p>>",
                lengthMenu:[
                    [5,10,25,50,100,-1],
                    [5,10,25,50,100,"All"]   
                ]
            } );
    
            table.buttons().container()
                .appendTo( '#table_wrapper .col-md-5:eq(0)' );
        } );
    </script>
    

    where can i place the code.?

  • allanallan Posts: 61,435Questions: 1Answers: 10,049 Site admin

    order is an initialisation option. See this section of the manual for how to use the initialisation options.

    Allan

Sign In or Register to comment.