Disable sorting for a particular column in jQuery DataTables

前端 未结 23 1578
礼貌的吻别
礼貌的吻别 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:46

    If you already have to hide Some columns, like I hide last name column. I just had to concatenate fname , lname , So i made query but hide that column from front end. The modifications in Disable sorting in such situation are :

        "aoColumnDefs": [
            { 'bSortable': false, 'aTargets': [ 3 ] },
            {
                "targets": [ 4 ],
                "visible": false,
                "searchable": true
            }
        ],
    

    Notice that I had Hiding functionality here

        "columnDefs": [
                {
                    "targets": [ 4 ],
                    "visible": false,
                    "searchable": true
                }
            ],
    

    Then I merged it into "aoColumnDefs"

提交回复
热议问题