Disable sorting for a particular column in jQuery DataTables

前端 未结 23 1568
礼貌的吻别
礼貌的吻别 2020-11-30 19:58

I am using the jQuery DataTables plugin to sort the table fields. My question is: how do I disable sorting for a particular column? I have tried with the following code, but

23条回答
  •  無奈伤痛
    2020-11-30 20:40

    As of 1.10.5, simply include

    'orderable: false'

    in columnDefs and target your column with

    'targets: [0,1]'

    Table should like like:

    var table = $('#data-tables').DataTable({
        columnDefs: [{
            targets: [0],
            orderable: false
        }]
    });
    

提交回复
热议问题