DataTable Single column click
DataTable Single column click
Hi Everyone,
I installed datatables in one of my application but it executes on click of 3 column heading while I have 5 columns. Although I need data sorting on the click of only last column heading and not others,
Can anyone help me out?
Thanx in advance.
This is my code :
[code]
jQuery.fn.dataTableExt.oSort['string-case-asc'] = function(x,y) {
return ((x < y) ? -1 : ((x > y) ? 1 : 0));};
jQuery.fn.dataTableExt.oSort['string-case-desc'] = function(x,y) {
return ((x < y) ? 1 : ((x > y) ? -1 : 0));};
$('#example').dataTable( {
"aaSorting": [[4,'asc']],
"aoColumnDefs": [
{"sType": 'string-case', "aTargets":[4]}
]
});
[/code]
I installed datatables in one of my application but it executes on click of 3 column heading while I have 5 columns. Although I need data sorting on the click of only last column heading and not others,
Can anyone help me out?
Thanx in advance.
This is my code :
[code]
jQuery.fn.dataTableExt.oSort['string-case-asc'] = function(x,y) {
return ((x < y) ? -1 : ((x > y) ? 1 : 0));};
jQuery.fn.dataTableExt.oSort['string-case-desc'] = function(x,y) {
return ((x < y) ? 1 : ((x > y) ? -1 : 0));};
$('#example').dataTable( {
"aaSorting": [[4,'asc']],
"aoColumnDefs": [
{"sType": 'string-case', "aTargets":[4]}
]
});
[/code]
This discussion has been closed.
Replies
http://datatables.net/development/sorting#data_source
[code]
var sortColumnIndex = 5;
JQuery.fn.dataTableExt.afnSortData['dom-text'] = function ( oSettings, iColumn ) {
if (iColumn === sortColumnIndex) {
}
}
[/code]