Coming from a query using CodeIngniter, data related to the day of the week is converted into the native query:
[...],
Case
when DATEPART(DW, cast(registro.data_registro as date)) = 0 then 'Domingo'
when DATEPART(DW, cast(registro.data_registro as date)) = 1 then 'Segunda'
when DATEPART(DW, cast(registro.data_registro as date)) = 2 then 'Terça'
when DATEPART(DW, cast(registro.data_registro as date)) = 3 then 'Quarta'
when DATEPART(DW, cast(registro.data_registro as date)) = 4 then 'Quinta'
when DATEPART(DW, cast(registro.data_registro as date)) = 5 then 'Sexta'
when DATEPART(DW, cast(registro.data_registro as date)) = 6 then 'Sabado'
end as DiaSemana, [...]
A simple html table:
<table id="tabela_espelho" class="table table-bordered table-striped table-condensed flip-content" style="display: none">
<thead class="flip-content">
<tr>
<th title="Matrícula">Matrícula</th>
<th title="Nome">Nome</th>
<th title="Data da Inconsistência">Data Inconsist.</th>
<th title="Dia da Semana">Dia Semana</th>
<th title="Inconsistência">Inconsistência</th>
</tr>
</thead>
</table>
By inserting into the DataTable, the days appear perfectly within the correct column, written from Sunday to Saturday (including, I would like to order from Monday - Sunday), but can not sort them correctly, It's in alphabetical order, but I need it to be by day of the week, could anyone help me? preference I use the datatable via script with ajax passing parameters via post, with converters of type:
{"data": "DiaSemana", "width": "12%"},
{type: 'date-euro', targets: [2]}, //Conversor de data/hora
{type: 'percent', targets: [2]}, //Conversor de porcentagem
Summarizing :
What I'm looking for is the ability to sort Ascending and Descending correctly the days of the week column with the starting day being Monday and last Sunday using the { type} as the above converters.