Sorting a DataTable column by a field of type DateTime

0

I have the following field in my model:

[Required]
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
public DateTime? DataCadastro { get; set; }

I use the DisplayFormat to format and display the date in Brazilian format later on a DataTable. But it is not being ordered properly. Do I need to put anything else in the dataTable?

$('#table-controle').html(data);
dataTable = $('#table-controle').dataTable({
    "language": {
        "url": "../../../Content/json/Portuguese-Brasil.json"
    }
});
    
asked by anonymous 22.08.2016 / 17:44

0 answers