Datatable Sorting
Datatable Sorting
bhupendraramani
Posts: 4Questions: 0Answers: 0
Hi Allan ,
I have 4 columns in my datatable and by default I want sorting by 1st column always. I am using 1.6.2 version of datatable.
I have written following code on document.ready function
tTable = $("#ticketsTable").dataTable({
bProcessing: true,
bServerSide: true,
sAjaxSource: a,
fnServerData: fnDataTablesPipeline,
fnDrawCallback: afterTableDraw,
fnInitComplete: drawBorders,
"sScrollY": "200",
"bScrollCollapse": true,
"iDisplayStart": displayStart,
"iDisplayLength": lastIndex,
"bScrollInfinite": true,
"bScrollCollapse": true,
"sScrollY": "100px",
"iScrollLoadGap": 10,
bJQueryUI: true,
oLanguage: { sProcessing: "", sZeroRecords: "SeatKarma found no tickets for this event.", sSearch: "", oPaginate: { sNext: ">", sPrevious: "<"} }
});
Thanks in Advance
Regards
Bhupendra
I have 4 columns in my datatable and by default I want sorting by 1st column always. I am using 1.6.2 version of datatable.
I have written following code on document.ready function
tTable = $("#ticketsTable").dataTable({
bProcessing: true,
bServerSide: true,
sAjaxSource: a,
fnServerData: fnDataTablesPipeline,
fnDrawCallback: afterTableDraw,
fnInitComplete: drawBorders,
"sScrollY": "200",
"bScrollCollapse": true,
"iDisplayStart": displayStart,
"iDisplayLength": lastIndex,
"bScrollInfinite": true,
"bScrollCollapse": true,
"sScrollY": "100px",
"iScrollLoadGap": 10,
bJQueryUI: true,
oLanguage: { sProcessing: "", sZeroRecords: "SeatKarma found no tickets for this event.", sSearch: "", oPaginate: { sNext: ">", sPrevious: "<"} }
});
Thanks in Advance
Regards
Bhupendra
This discussion has been closed.
Replies
[code]
var oTable = $('#example').dataTable({
"aaSorting": [[1,"asc"]], // Sort on the first visible column in ascending order
});
[/code]
[code]
"aoColumnDefs": [
{ "aTargets": [ "COL_SAMPLE" ],
"bSortable": false,
}
]
});
[/code]
Its working fine for first time , but when I am going to sort another column and refreshing page then it will not give me default sorting by 1st column
instead of doing clientside sorting why dont you let your serverside logic do all the sorting for you that way when the table is refreshed sorting is based on the first column only or any other column you want it to be.
Arjun
Resolve .... your trick works for me