У меня есть таблица со следующими столбцами:
<thead>
<tr>
<th style="display:none;">ID</th>
<th>Nombre Material</th>
<th style="width:30%">Nº Parte</th>
<th>Aprobado</th>
<th>REV</th>
<th>Diámetro</th>
<th>Largo</th>
<th>Top</th>
<th>Bottom</th>
<th>Otros</th>
<th>Dado/Dia</th>
<th>Uni/Cajas</th>
<th class="rotate"><div><span>Orden Interna</span></div></th>
<th class="rotate"><div><span>Plano de Corte</span></div></th>
<th class="rotate"><div><span>Plano Marcación</span></div></th>
<th class="rotate"><div><span>Instruc. de Trabajo</span></div></th>
<th class="rotate"><div><span>Plano Especifica</span></div></th>
<th class="rotate"><div><span>Instruc.Sheet Cliente</span></div></th>
<th class="rotate"><div><span>Drawing Cliente</span></div></th>
<th>Última orden emitida</th>
<th>Cliente Final</th>
<th>Editar Datos</th>
</tr>
</thead>
Я организую таблицу, используя rowGroup
, чтобы поместить все строки в одинаковый набор (каждый со своим семейством), код, который я использую вот что:
//SE INICIALIZA LA TABLA
$('.tablaPulse').DataTable({
"aoColumns": [
null,
null,
null,
{ "sType": "date" },
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
{ "sType": "date" },
null,
null
],
"columnDefs": [
{ "visible": false, "targets": 1 },
{
"targets": 3,
//type: 'datetime-moment'
"render": $.fn.dataTable.moment('YYYY/MM/DD', 'DD/MM/YYYY')
}
],
//order: [[1, 'asc']],
rowGroup: {
startRender: function (rows, group) {
return $('<tr/>')
.append('<td class="numPul" bgcolor="#78923B">' + group + '</td>')
.append('<td class="numPul" bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>')
.append('<td bgcolor="#78923B"></td>');
},
endRender: null,
dataSrc: 1
}
});
Таблица выглядит следующим образом:
Когда я пытаюсь отсортировать все по дате, он заказывает мне все по дням / месяцам, а не по дате, например, в этом случае он заказывает мне даты от 31 и пропускает годы:
Код, в котором я инициализировал таблицу, был меньше, я добавил несколько примеров кода, которые я видел на inte rnet, и они не работают для меня, части кода, которые я добавил, были:
"aoColumns": [
null,
null,
null,
{ "sType": "date" },
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
{ "sType": "date" },
null,
null
],
и ...
{ "targets": 3,
//type: 'datetime-moment'
"render": $.fn.dataTable.moment('YYYY/MM/DD', 'DD/MM/YYYY')
}
и все равно ничего не работает, что я могу изменить или добавить, чтобы я мог упорядочить даты как следует?
PD: I уже добавлено moment.js