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 Displayformat to format and display the date in Brazilian format later in a Datatable. But it’s not being sorted correctly. I need to put something else in the datatable ?
$('#table-controle').html(data);
dataTable = $('#table-controle').dataTable({
"language": {
"url": "../../../Content/json/Portuguese-Brasil.json"
}
});
You can put your code here on Jsfidlle?
– Marconi
Raphael, a piece of advice, unless you’re doing something trivial, like a popular textbox, avoid formatting server-side values, blibiotecas like datatables work best with json suffering the least amount of possible inteference. in your case, I believe it is best to use the following datatables plugin
datetime
together with thecolumns.type
date
– Tobias Mesquita
I found the solution in this post: http://stackoverflow.com/questions/12124746/disable-automatic-sorting-on-the-first-column-when-using-jquery-datatables
– Raphael Prado de Oliveira