$(document).ready(function () {
    //Custom ordering tables
    jQuery.fn.dataTableExt.oSort["byDate-pre"] = function(num) {
        let splt = num.split('.')
        text = splt[2]+splt[1]+splt[0]
        return parseInt(text)
    }
    jQuery.fn.dataTableExt.oSort["byDate-asc"] = function(num) {
        let splt = num.split('.')
        text = splt[2]+splt[1]+splt[0]
        return parseInt(text)
    }
    jQuery.fn.dataTableExt.oSort["byDate-desc"] = function(num) {
        let splt = num.split('.')
        text = splt[2]+splt[1]+splt[0]
        return parseInt(text)
    }

    var dt = $("#pats_datatable").DataTable({
      "scrollX": true,
      "aoColumnDefs": [{
        "sType": "byDate",
        "bSortable": true,
        "aTargets": [2]
      }
      ]
    });

    $('#pats_datatable').DataTable().order([[2, 'pre']]).draw();
    $('#pats_datatable').DataTable().column(0).visible(false);

});
