Order by data
Order by data
Hi all,
I have a problem with the order of column date in table:
oTable =$('#idTable').dataTable( {
"bFilter" : false,
"bRetrieve": true,
"bDestroy": true,
"fnDrawCallback":
function() {
clickRowHandler();
},
"aoColumnDefs": [
{"bVisible": false,
"aTargets": [ 9 ]
}],
"aaSorting": [ [7,'asc'] ]
} );
The column seven is a date column with the format "dd/mm/yy hh:mm:ss", and the table show this order:
2/06/12 0:00:00
24/05/12 0:00:00
25/05/12 0:00:00
26/05/12 0:00:00
27/06/12 0:00:00
31/05/12 0:00:00
Thanks in advance.
I have a problem with the order of column date in table:
oTable =$('#idTable').dataTable( {
"bFilter" : false,
"bRetrieve": true,
"bDestroy": true,
"fnDrawCallback":
function() {
clickRowHandler();
},
"aoColumnDefs": [
{"bVisible": false,
"aTargets": [ 9 ]
}],
"aaSorting": [ [7,'asc'] ]
} );
The column seven is a date column with the format "dd/mm/yy hh:mm:ss", and the table show this order:
2/06/12 0:00:00
24/05/12 0:00:00
25/05/12 0:00:00
26/05/12 0:00:00
27/06/12 0:00:00
31/05/12 0:00:00
Thanks in advance.
This discussion has been closed.
Replies
Allan
But my problem now is other, I need load the table in a determinate page, and now I don't know the position of tr, because I don't know the order of table until the table is loaded.
Ej:
$('#table tbody tr').each( function(i) {
var aData=$('td', this);
var iIdRow=$(aData[1]).text();
if (i%10==0){
nMod=i;
}
if (iId==iIdRow){ //iId --> global value
$('#table tbody tr:eq('+i+')').addClass('row_selected');
nPageIni=nMod;
}
} );
oTable =$('#table').dataTable( {
"bFilter" : false,
"bRetrieve": true,
"bDestroy": true,
"iDisplayStart": nPageIni, //the value is correct before to order table
"fnDrawCallback":
function() {
clickRowHandler();
},
"aoColumnDefs": [
{"bVisible": false,
"aTargets": [ 9 ]
}],
"aaSorting": [ [9,'asc'], [7,'asc'],[4,'asc'] ],
"aoColumns": [
null,
null,
null,
null,
null,
null,
null,
{ "sType": "date-euro" },
null,
null]
} );
Having said that, this API plug-in might help: http://datatables.net/plug-ins/api#fnDisplayRow .
Allan
I want to change iDisplayStart because when I obtained the number of page, the table isn't in the correct order, when table do the load and to order the table, the number of page that I was obtained isn't valid, because this number has been obtained before to order the table.
Thanks in advance.