Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81910

Proper Syntax for Initializing "Order" Functionality

$
0
0

I am trying to use the "order" functionality to sort the 9th column in my table by default. When I try to initialize the datatables using the code below, the datatables functionality fails to appear on page load (HTML table is present, though).

I believe I have followed the documentation for "order" correctly. Any obvious problems in my initialization code below?

https://datatables.net/examples/basic_init/table_sorting.html

<!-- Link out for Jquery, which is a dependency for datatables -->

<script
  src="https://code.jquery.com/jquery-3.2.1.js"
  integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE="
  crossorigin="anonymous"></script>

<!-- Link out for datatables -->

<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.16/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.16/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/buttons/1.4.2/js/buttons.print.min.js"></script>

<script language="javascript">

$(document).ready( function () {
    $('#table_id').DataTable( {
          "order": [[10, "desc"]]
          dom: 'Bfrtip' ,
          buttons: [
              'pageLength',
              'print'
          ]
    }  );
} );

</script>


Viewing all articles
Browse latest Browse all 81910

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>