Datatables Defaults

by Dan Hebert

HTML

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="//cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="//cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<table id="sortingWorks">

</table>

<table id="whyIsItWrong">

</table>

JavaScript

$(document).ready(function() {

$("#sortingWorks").DataTable({
	columns: [
  	{ title: "Quantity", sortable: true }
  ],
  data: [
  	[ "1,123" ],
    [ "11" ],
    [ "1,223" ],
    [ "1,000" ],
    [ "999" ],
    [ "12,345" ]
  ]
});

//Set the defaults
$.extend(true, $.fn.dataTable.defaults,
        {
            "language": {
                "decimal": ".",
                "thousands": ","
            }
        });
        
//Create Version 1
$("#whyIsItWrong").DataTable({
	columns: [
  	{ title: "Quantity", sortable: true }
  ],
  data: [
  	[ "1,123" ],
    [ "11" ],
    [ "1,223" ],
    [ "1,000" ],
    [ "999" ],
    [ "12,345" ]
  ]
});


});