DataTable Single column click

DataTable Single column click

jabirjabir Posts: 1Questions: 0Answers: 0
edited May 2012 in General
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]

Replies

  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    Maybe this helps?

    http://datatables.net/development/sorting#data_source

    [code]
    var sortColumnIndex = 5;

    JQuery.fn.dataTableExt.afnSortData['dom-text'] = function ( oSettings, iColumn ) {
    if (iColumn === sortColumnIndex) {

    }
    }
    [/code]
This discussion has been closed.