Disable sort on particular column

Disable sort on particular column

neonWiredneonWired Posts: 2Questions: 0Answers: 0
edited July 2011 in General
Can I disable sorting on a particular column, if so how?

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    Yes. In a column definition (using either aoColumns or aoColumnDefs) set bSortable: "false"

    with aoColumns you specify a value for every column
    with aoColumnDefs you specify values only for columns you want, and attach them to aTargets column indexes

    [code]
    $(document).ready(function() {
    $('#example').dataTable( {
    "aoColumnDefs": [
    { "bSortable": false, "aTargets": [ 3 ] } // aTargets is an array of which columns (starting at 0) to apply this definition to. 3 is the 4th column. you can specify multiple columns like [0, 1, 3, 8]
    ]
    } );
    } );
    [/code]

    column settings described: http://www.datatables.net/usage/columns
    good reference for more settings on http://datatables.net/ref
This discussion has been closed.